[Mono-bugs] [Bug 605295] New: Memory leak when marshaling an instance delegate

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed May 12 14:39:54 EDT 2010


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

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


           Summary: Memory leak when marshaling an instance delegate
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: Other
        OS/Version: openSUSE 11.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: lluis at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


This test case makes memory grow quickly. It works fine if the instance
delegate (cls.Run) is replaced by a delegate to a static method.

using System;
using System.Runtime.InteropServices;

namespace DelegateTest
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            MainClass cls = new MainClass ();
            while (true) {
                uint id = g_timeout_add (500, cls.Run, IntPtr.Zero);
                g_source_remove (id);
            }
        }

        bool Run ()
        {
            return false;
        }

        [DllImport("libglib-2.0.so")]
        static extern void g_source_remove (uint id);

        [DllImport("libglib-2.0.so")]
        static extern uint g_timeout_add (uint id, Func<bool> function, IntPtr
data);
    }
}

-- 
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