[Mono-dev] Leaky JIT while running MonoDevelop

Rodrigo Kumpera kumpera at gmail.com
Tue Aug 19 08:34:11 EDT 2008


Hi,

I spent a few hours yesterday trying to reproduce your bug without success.
I have to say that from your valgrind result, the issue is closely related
to how
your perforce library interact with unmanaged code - it happens when you
pass a delegate to a pinvoke and somehow memory is leaked.

Do you mind sharing the code and say what exactly your code is calling so I
can try to produce a repro? You can send it directly to me if you don't want
to send it to
a public mailing list.

Thanks,
Rodrigo

On Fri, Aug 15, 2008 at 8:22 PM, Casey Marshall
<casey.s.marshall at gmail.com>wrote:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080819/068803b5/attachment.html 


More information about the Mono-devel-list mailing list