[Mono-bugs] [Bug 599693] New: continous loading and unloading of domain leaks memory

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 26 11:17:25 EDT 2010


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

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


           Summary: continous loading and unloading of domain leaks memory
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: i586
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: lucas.meijer at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US)
AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2

run this reproprogram, and watch it eat all your memory over time:

#include <glib.h>
#include <string>
#include <mono/jit/jit.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/mono-gc.h>

int main()
{
    MonoDomain* domain = mono_jit_init_version ("Unity Root Domain",
"v2.0.50727");
    MonoMethodDesc* desc = mono_method_desc_new("Lucas:Doit()",true);
    std::string assembly("lucas.dll");

    for (;;)
    {
        MonoDomain* child = mono_domain_create_appdomain("Unity Child Domain",
NULL);
        mono_domain_set (child, FALSE);

        MonoAssembly* ass = mono_domain_assembly_open (mono_domain_get (),
assembly.c_str());
        MonoImage* img = mono_assembly_get_image(ass);
        MonoMethod* m = mono_method_desc_search_in_image(desc,img);
        MonoObject* exc;
        MonoObject* ret = mono_runtime_invoke(m,0,0,&exc);
        mono_domain_set(mono_get_root_domain(), false);
        mono_domain_unload(child);
        mono_gc_collect(mono_gc_max_generation());
    }

    return 0;
}


with lucas.dll being built from:

public class Lucas
{
 static void Doit()
 {
  System.Console.WriteLine("DOing it, doing it");
 }
}

Reproducible: Always

Steps to Reproduce:
1. compile the testprogram pasted into the details
2. compile lucas.dll from lucas.cs mentioned in the details
3. run the program, and watch it eat all your memory.
Actual Results:  
leaking memory

Expected Results:  
not leaking memory

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