Improved Garbage Collection performance

John Neil
Wed Nov 19 04:42:00 GMT 2003

Following a post from Jeff Sturm, I tried two relatively simple
modifications to gcj and boehm garbage collection and was able to gain a
200-300% improvement on a full garbage collection (from ~150ms to ~50ms).

The first modification was to only scan the initialized class rather than
the entire .data section.  This was achieved using a function similar to
Jv_MarkObj and by iterating over the class found in the JCR Section.  The
.data section could then be removed from the register roots.

The second modification was to modify the gcj compiler to store all static
class pointers, which are normally stored in the .bss section, into a
section of their own (GCJCLASS).  The scan of the .bss section was then
restricted to this new GCJCLASS section which only contains class pointers.
In addition, some variables within native c++ code had to be moved into this
section from the .bss section using the .section attribute.

Whilst on GC, I was wondering what is the difference between _Jv_Malloc and
JV_MallocUnchecked.  I think I understand the use of the boehm memory
functions (see table below), but I am not use how this is mapped to the
corresponding Jv functions

Boehm function                 
GC_malloc                        Scanned       Collectable     Jv_AllocObj
GC_malloc_atomic                 Not-Scanned   Collectable     Jv_AllocBytes
GC_malloc_uncontrollable         Scanned       Not-collectable ?
GC_malloc_atomic_uncontrollable  Not-Scanned   Not-collectable Jv_Malloc


More information about the Java mailing list