Off-heap object space

Andrew Dinn adinn at
Wed Jan 20 09:53:40 UTC 2016

On 20/01/16 07:35, Khanh Nguyen wrote:
> As I understand it, card table marking is there only to prevent leaks since
> objects in young generation can be solely reached from old generation.
> Let's say I don't care about those off-heap objects right now, i.e., I'm
> willing to let them be leaks. Then I don't need a card table for off-heap
> memory.
> That's exactly my situation right now: I have malloced a space, have
> objects allocated in it and boom, JVM just crashes (randomly)

I am afraid your statement above about why card table marking is needed
only addresses part of a much bigger picture. There is a lot more to
managing memory than preventing leaks. Card table marking is only one
technique that may be used to achieve several inter-related goals which
a GC must address.

I suggest you do some background reading on garbage collection in order
to understand why the assumption that you can simply allocate a memory
region and use it to house objects is over-simple. Richard Jones' book
on garbage collection provides a very comprehensive account. You will
probably find the first edition (Garbage Collection: Algorithms for
Automatic Dynamic Memory Management by Richard Jones & Rafael Lins) more
helpful than the later revised edition as the former provides a more
comprehensive explanation of the basic ideas. However, both books are
well worth reading.

My personal view is that an understanding of the information the first
book presents (if not also the second one) is a pre-requisite for anyone
attempting to improve the way the JVM manages memory.


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (US), Michael O'Neill (Ireland), Paul
Argiry (US)

More information about the hotspot-dev mailing list