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

Zoltan Varga vargaz at gmail.com
Sat Aug 25 17:34:03 EDT 2007


Try valgrind or create a small test-case and attach it to a bug report at


On 8/25/07, Sebastian Good <sebastian at palladiumconsulting.com> wrote:
> 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
> >

More information about the Mono-devel-list mailing list