Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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.
|