Blocks :
|
|
Duplicate :
|
When allocating a new (larger) mark stack, the old mark stack is never uncommitted, leaking the old mark stacks' memory (and the memory mapping) I.e. the code calls _virtual_space.release() with the comment that that call frees the memory, but the first comment of VirtualSpace::release() explicitly mentions that this method does not actually free the memory (and the code really does not). Other bugs in that code: - there seems to be a typo in the comment of VirtualSpace::release() - during resizing the mark stack, if we fail to commit the new mark stack memory we issue a fatal() call to terminate the VM. This is actually not required, and the intention of that code is to simply reuse the old one. On the other hand, if during initial allocation of the mark stack we fail to commit the space, we do not terminate the VM, and actually we exit the G1ConcurrentMark constructor in the middle of the method, leaving parts of the class uninitialized. - there is a lot of code duplication in G1CMMarkStack::allocate() (initial allocation) and G1CMMarkStack::expand() - the code that reallocates the mark stack does not notify the NMT MemTracker that that memory is property of the GC. - some log messages of the allocation/expansion code wrongly talk about memory sizes in (kilo-)bytes while they print number of elements (actually kilo-elements as it divides the elements by "K") Fix this.