[Mono-bugs] [Bug 568644] New: GC.Collect() does not collect WeakReferences

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jan 6 12:33:58 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=568644

http://bugzilla.novell.com/show_bug.cgi?id=568644#c0


           Summary: GC.Collect() does not collect WeakReferences
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: 32bit
        OS/Version: Windows 7
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: GC
        AssignedTo: lupus at novell.com
        ReportedBy: lesnikowski at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6)
Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)

        [Test]
        public void WeakReference_IsGarbageCollected()
        {
            WeakReference weak = new WeakReference(new object());
            Assert.IsTrue(weak.IsAlive);
            GC.Collect();
            Thread.Sleep(TimeSpan.FromSeconds(10));
            Assert.IsFalse(weak.IsAlive);
        }

Reproducible: Always

Steps to Reproduce:
        [Test]
        public void WeakReference_IsGarbageCollected()
        {
            WeakReference weak = new WeakReference(new object());
            Assert.IsTrue(weak.IsAlive);
            GC.Collect();
            Thread.Sleep(TimeSpan.FromSeconds(10));
            Assert.IsFalse(weak.IsAlive);
        }
Actual Results:  
weak.IsAlive is true

Expected Results:  
weak.IsAlive should be false

Test passes on MS implementation .NET Framework

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list