[m-dev.] track down a memory leak

Peter Ross peter.ross at miscrit.be
Wed Sep 13 20:10:15 AEDT 2000


On Wed, Sep 13, 2000 at 03:19:46AM +1100, Fergus Henderson wrote:
> On 12-Sep-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> > I have the unfortunate problem that the heap only grows running under
> > the grade hlc.par.gc under windows, I have finally got a DLL built with
> > GC_generate_random_backtrace() available.  However it prints out
> > nothing!
> > 
> > Any ideas what to do next?
> 
> Don't forget that you have to explicitly invoke
> GC_generate_random_backtrace(), e.g. from the gdb prompt -- simply
> having an executable built that includes the function won't make it
> get called.
> 
> If you were already calling GC_generate_random_backtrace(), and it
> wasn't producing any output, I'd try setting a breakpoint at
> GC_printf(), which should get called from
> GC_generate_random_backtrace(), and tracing through it to find out
> what the output would have been and why the output doesn't go to the
> screen.
> 
Problem discovered the output is placed in a file called `gc.log'.

Another hint is that you must also define GC_DEBUG for any source file
whose mallocs you want to debug, not just in the library (I was assuming
that defining GC_DEBUG in the library meant that you used the debug
version).

Pete
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list