Garbage collector memory leak "feature"?

David Brown dlang at davidb.org
Fri Oct 12 23:50:33 PDT 2007


On Sat, Oct 13, 2007 at 02:07:28PM +0900, Bill Baxter wrote:

> I posted a bug about AA's causing memory exhaustion (with a test case).  If 
> you're talking about a bug where false pointers on the stack cause memory 
> exhaustion, I don't think anyone has actually run across such a case in 
> practice.

The reason is that as long as the set of false pointers is bounded, the
amount of unreclaimed memory is also unbounded.

The bad leaks happen when the allocated blocks themselves contain false
pointers, and continuous allocation generates more false pointers.

A good reference about this is:
    <http://www.hpl.hp.com/techreports/2001/HPL-2001-251.html>

It explains that as long as the the number of misidentified pointers is
itself is bounded, then it will at worst result in a constant size of
unreclaimed memory.

In other words, it would probably be good to come up with a way to
distinguish pointers in classes from other data, since this easily results
in unbounded leaks, but false pointers on the stack don't cause unbounded
leaks.

The paper also explains how (provided you get rid of the unbounded leaks),
the constant unreclaimed data will be better than a continual leak caused
by a manually managed program with a gradual leak.

David



More information about the Digitalmars-d mailing list