6423256: marking stacks should use a chunked data structure

John Coomes John.Coomes at sun.com
Wed Nov 5 23:36:36 UTC 2008

Scott Marlow (scott.marlow.opensource at gmail.com) wrote:
> Is anyone working on this bug yet?  From the bug report 
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6423256, it sounds 
> like someone started the work already.  I would like to help with the 
> issue (either testing a proposed fix or submitting one).

Hi Scott,

Glad you want to help!  One of our (former) colleagues implemented
growable stacks just before he moved on to another group at Sun.  I'm
now the guardian of his changes.  I haven't looked at it in detail,
but I believe the code is complete and has had some testing.
Certainly more would be in order.

I'll post a webrev in a day or two.  If you're willing you can review
it and/or take the patch, build it and do some testing.


> The bug report contains this text:
> "
> The marking stack used by MarkSweep currently uses a GrowableArray<oop>. 
> That's overkill, since we only use the marking stack as a stack. In 
> contrast, GrowableArray implements an array, so when it expands, it 
> reallocs and copies the whole array to a new, larger, piece of 
> contiguous memory. Since the marking stack is often large, this often 
> requires a large contiguous chunk of memory, which can be difficult to 
> acquire. Since GrowableArray grows by doubling, on average 25% of the 
> array will be empty. When the marking stack is large, this can be a 
> substantial waste of space.
> Instead, the stack could be implemented as a chained series of small regions.  This could allow us to balance the storage for the chain pointers  against the increment of growth, to use an appropriate amount of space in modest chunks.
> Posted Date : 2006-05-08 23:47:21.0
> "
> Scott

More information about the hotspot-gc-dev mailing list