[Mono-dev] Leaky JIT while running MonoDevelop

Casey Marshall casey.s.marshall at gmail.com
Fri Aug 15 19:22:26 EDT 2008


Zoltan Varga wrote:
> Hi,
> 
>   Try running the app with G_SLICE=always-malloc. That would force
> glib to allocate all
> memory using malloc, helping valgrind to produce more meaningful leak reports.
> 

That was immensely helpful! It now looks like it's leaking information 
about function pointers-to-delegates -- created by 
Marshal.GetFunctionPointerForDelegate.

This trace is showing it leaking in my Perforce interop code, but I'm 
pretty sure other sources are leaking these, too:

> ==31524== 466,386,527 bytes in 19,432,782 blocks are indirectly lost in loss record 231 of 232
> ==31524==    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
> ==31524==    by 0x5069EBB: g_malloc (in /usr/lib/libglib-2.0.so.0.1600.4)
> ==31524==    by 0x50810EE: g_strdup (in /usr/lib/libglib-2.0.so.0.1600.4)
> ==31524==    by 0x47FA32: mono_mb_new (method-builder.c:86)
> ==31524==    by 0x479977: mono_marshal_get_managed_wrapper (marshal.c:8970)
> ==31524==    by 0x479DA2: mono_delegate_to_ftnptr (marshal.c:688)
> ==31524==    by 0x8F58757: (wrapper managed-to-native) System.Object:__icall_wrapper_mono_delegate_to_ftnptr (object)
> ==31524==    by 0x178FD277: P4API.ClientUser:SwigDirectorConnect ()
> ==31524==    by 0x178FB25B: P4API.ClientUser:.ctor ()
> ==31524==    by 0x4C78EC: mono_runtime_invoke_array (object.c:3214)
> ==31524==    by 0x4DA29F: ves_icall_InternalInvoke (icall.c:3016)
> ==31524==    by 0x8BAC75F: (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)

I've disabled my Perforce code, and am running it again to make sure, 
but it does still look like it's leaking.

Is this comment, from mono/metadata/loader.c, in mono_free_method, related?

> 	if (method->signature) {
> 		/* 
> 		 * FIXME: This causes crashes because the types inside signatures and
> 		 * locals are shared.
> 		 */
> 		/* mono_metadata_free_method_signature (method->signature); */
> 		/* g_free (method->signature); */
> 	}
> 	

Thanks.


More information about the Mono-devel-list mailing list