[Mono-dev] managed code wrappers (exceptions & garbage collection across pinvoke barriers)

Sebastian Good sebastian at palladiumconsulting.com
Sat Aug 25 17:26:59 EDT 2007


I have not attempted to run a memory profiler on my example, but the
brute-force method of letting the code run in a loop causes the process to
eventually run out of memory. What is the recommended way to debug these
leaks? On the suspicion it was actually just the managed copy of the input
string that was never having a chance to collect, I even ran the mono
garbage collector explicitly. (Such silly ideas don't usually pan out -- and
this was no exception.)

On 8/25/07, Zoltan Varga <vargaz at gmail.com> wrote:
>
>                                     Hi,
>
>   The input parameter is converted by the runtime from ut8 to a managed
> string
> object, which is handled by the GC, so there should be no leak there. The
> result
> is converted from a managed string object to ut8, and the caller should
> free it
> using g_free (). So your example code should work without a leak.
>
>                Zoltan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070825/960c0395/attachment.html 


More information about the Mono-devel-list mailing list