[Gc] Effective heap utilization
bruce at hoult.org
Wed Oct 10 04:56:53 PDT 2007
On 10/11/07, Ludovic Courtès <ludovic.courtes at laas.fr> wrote:
> Any idea what the typical "effective" heap utilization is, or how to
> measure it?
> By "effective utilization", I'm referring to the ratio of the total
> allocated heap size to the amount of heap occupied by live objects.
It's not easy to figure out for a number of reasons.
The simplest idea is to do a GC_dump() and look at the number of mark
bits set in each heap block compared to the possible number of objects
in that block (the blocksize divided by the size of objects in that
This doesn't work for blocks containing uncollectable objects, for
which the GC doesn't bother maintaing the mark bits. (my local copy
has been modified to set the mark bit when allocating an uncollectable
object and clear it when freeing it precisely so I can get more
information from GC_dump())
Note that this information is as at the end of the last GC and so is
the smallest number of live objects in a GC cycle.
Note also that object sizes are rounded up so as to limit the number
of different pool sizes in use. This means that the actual useful
memory is less than indicated by the above calculation. You could
disable object size rounding up and compare.
More information about the Gc