[gclist] Java Developer's Journal GC advice

David Chase dr2chase@mac.com
Fri, 5 Sep 2003 22:39:40 -0400


> I don't view clearing of pointers as equivalent to explicit freeing:  
> The former is type-safe, while the latter isn't.  I don't think you 
> can avoid pointer clearing completely if you care about space usage:

This is not entirely true.  You can use typed pools to recycle objects. 
  In my experience,
if you can recycle at least moderately complex objects, this is faster 
than garbage
collection.  It's not fun, but it is typesafe, and the measurements 
were done carefully
and run on realistic examples for a realistic application (caveat -- 
this was a
uniprocessor, and the synchronization on the storage pools would be more
expensive on a multiprocessor).

Note that this result is not entirely applicable to the JScheme 
platform.  The
obvious candidates for recycling in a pool (e.g., cons cells) are not 
complex
enough.

David Chase