[jdom-interest] JDOM Document size

James Duncan Davidson duncan at x180.net
Fri Feb 9 12:44:12 PST 2001

on 2/8/01 6:44 PM, Jason Hunter at jhunter at collab.net wrote:

> That approach suffers from the problem that all temporary objects
> created during the build will be represented despite the fact they're
> not in the document.  You might try a System.gc() but we've found here
> before that it doesn't really do a full gc, if it does a gc at all.
> (Testing on JDK 1.2.2 Windows shows System.gc() does nothing.)

System.gc() is only a *hint* to the garbage collector that it might find
right now to be a good time to do garbage collection. If it doesn't find
anything to collect, or decides that it's not worth its time to collect it,
then it won't. Typically the 1.2 collector won't kick in unless memory
allocation is getting tight. Until then it would rather see the system give
more precedence to running than to memory consumption.

Hotspot of course generates much less "sticky" garbage due to the nursery
and the fact that very few temporary objects will ever exist in a state
where the GC will ever see them.

James Duncan Davidson
http://x180.net/                                             !try; do();

More information about the jdom-interest mailing list