[gclist] memory leaks & Boehm collector

Fergus Henderson fjh@cs.mu.OZ.AU
Thu, 15 Jul 1999 10:48:28 +1000


My application is using the Boehm (et al) collector.
Unfortunately, it is leaking memory :-(

The application in question is the Mercury compiler.
It works fine if you compile one file at a time.
But if you specify a lot of files on the command line,
then it eventually runs out of memory (exceeding my ulimit),
even though the system ought to be able to garbage collect
all the memory allocated after each iteration of the outer loop.

One possible possible problem is that Mercury uses its own stacks
rather than using the C stack, and currently the collector does not
zero them out, so there may be old references lying around.
To avoid this, I added code to the outer loop to zero the Mercury stacks
and then explicitly invoke GC_gcollect() to force a garbage collection.
But I'm afraid that didn't help.

Any suggestions about how to go about debugging something like this?

I seem to recall Hans mentioning something about how it would be nice
to have a tracing tool that would take an arbitrary address and, if the
address was live, would give you back a trace showing the chain of
pointers from one of elements of the root set to that address.  Did
anyone ever get around to writing such a tool?

P.S. I'm using gc-4.14 on a dec-alpha-osf3.2 system, with egcs-1.1.2.

Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh@        |     -- the last words of T. S. Garp.