[Gc] Helping the garbage collector
Hans.Boehm at hp.com
Wed Jan 5 18:43:27 PST 2005
The easiest thing to do is generally to use GC_MALLOC_ATOMIC wherever
possible, and perhaps to design important data structures such that
it is possible for as many objects as possible.
You can also provide more detailed layout information for objects
containing some pointers, using one of several mechanisms. But the
benefit of that tends to be much more in avoiding worst cases than
improving average performance. In average cases, that seems to not
have much impact. Unlike GC_MALLOC_ATOMIC, the collector still has
to load at least part of each object in the cache during tracing.
If you see a large root set size, you could also try reducing that
with GC_exclude_static_roots, or by specifying statically allocated
Turning on GC_java_finalization makes sure that the collector traces
from objects about to be finalized, even if they are not finalized in
order. This matters only if you use unordered finalization. In
my opinion, you shouldn't, unless you are compiling a language that
requires it (i.e. Java or C#).
On Wed, 22 Dec 2004, [iso-8859-2] Bojan =A9ernek wrote:
> I'm interested in hearing out what I can do to help the garbage
> collector run as fast as possible. I run a home-brewn IDL compiler and
> know about all the types of generated C++ classes I have. I'm also
> interested what exactly java finalization does. If you need more
> information, feel free to ask.
> Bojan Sernek.
More information about the Gc