Verbose GC alwayshappen after Allocation Failure.
I. Object Allocation:
1. less than 512 bytes (768 bytes on 64-bit platforms) or Larger objects are allocated from the cache if they can be contained in the existing cache -> Cache allocation
2. If not satisfied in the existing cache -> Heap lock allocation -> Attempted in SOA (Small Object Area) at first:
2.1 ifsatisfy, Enjoy your new object!
2.2 if no satisfy, but object size is less than 512 bytes -> Allocation Failure (AF)
2.3 if no satisfy, but object size is large than 512 bytes -> Attempted inLOA (Large Object Area):
2.3.1 if satisfy, Enjoy your new object!
2.3.2 if no satisfy, Allocation Failure ->Registers a GC cycle
II. GC cycle
1) STW (Stop The World)
2) Reclaim spaces of un-reachable objects
3) Marking -> Sweeping -> Compaction(optional, one condition: not enough free space is available to satisfy the allocation request)
Yes - 1. Successful object allocation
2. Possible Heap Shrinkage
NO - Heap Expansion Possible?
Yes Expand heap (Continuous), allocate object
No??? OutOfMemoryError (OOM)
Verbose GC alwayshappen after Allocation Failure.
I. Object Allocation:
1. less than 512 bytes (768 bytes on 64-bit platforms) or Larger objects are allocated from the cache if they can be contained in the existing cache -> Cache allocation
2. If not satisfied in the existing cache -> Heap lock allocation -> Attempted in SOA (Small Object Area) at first:
2.1 ifsatisfy, Enjoy your new object!
2.2 if no satisfy, but object size is less than 512 bytes -> Allocation Failure (AF)
2.3 if no satisfy, but object size is large than 512 bytes -> Attempted inLOA (Large Object Area):
2.3.1 if satisfy, Enjoy your new object!
2.3.2 if no satisfy, Allocation Failure ->Registers a GC cycle
II. GC cycle
1) STW (Stop The World)
2) Reclaim spaces of un-reachable objects
3) Marking -> Sweeping -> Compaction(optional, one condition: not enough free space is available to satisfy the allocation request)
Yes - 1. Successful object allocation
2. Possible Heap Shrinkage
NO - Heap Expansion Possible?
Yes Expand heap (Continuous), allocate object
No??? OutOfMemoryError (OOM)