United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6423256 GC stacks should use a better data structure
JDK-6423256 : GC stacks should use a better data structure

Details
Type:
Enhancement
Submit Date:
2006-05-08
Status:
Closed
Updated Date:
2011-03-25
Project Name:
JDK
Resolved Date:
2011-03-25
Component:
hotspot
OS:
linux_2.4,generic,windows
Sub-Component:
gc
CPU:
x86,unknown,generic
Priority:
P3
Resolution:
Won't Fix
Affected Versions:
6,6u6,6u14,6u20
Fixed Versions:
hs18

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Duplicate:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description
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.

                                    

Comments
EVALUATION

Since the mark sweep algorithm is used as a backstop collector for many of our collectors (e.g., -XX:+UseParallelGC, -XX:+UseParNewGC, -XX:+UseConcMarkSweepGC) in addition to its obvious use with -XX:+UseSerialGC, this issue may be present in non-obvious places.
                                     
2006-06-16
EVALUATION

The preserved_mark_stack and preserved_oop_stack used by mark sweep and CMS should also be converted to GrowableStacks (assuming they are used only as stacks).  Scott Marlow of <company unknown> was testing the growable marking stacks fix and his JVM died when trying to allocate an 80MB preserved mark stack.
                                     
2009-01-07
EVALUATION

Still more stack types that should be converted:  the stacks used by parallel collectors to handle task queue overflows; promotion failure scan stacks, revisit klass stacks, revisit mdo stacks.  Changing the synopsis to broaden the scope.
                                     
2009-09-21
EVALUATION

http://hg.openjdk.java.net/hsx/hsx17/baseline/rev/c475b10a610b
                                     
2010-04-17
EVALUATION

http://hg.openjdk.java.net/hsx/hsx17/master/rev/c475b10a610b
                                     
2010-04-17
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/894b1d7c7e01
                                     
2010-09-29
EVALUATION

http://hg.openjdk.java.net/hsx/hsx19/baseline/rev/0c5c902506a0
                                     
2010-10-08
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/894b1d7c7e01
                                     
2010-10-09



Hardware and Software, Engineered to Work Together