JVM memory model (text collation)

Time:2020-10-4

JVM memory model (text collation)

Four clock algorithm for GC Optimization:
1. Reference counting (disadvantages waste technical space, and when infinite loops)
2. Replication algorithm (waste a to area) applicable scenario: when the object survivability is low: new area
3. Mark clearing algorithm: (two scans seriously waste time and lead to memory fragmentation) (no extra space required)
4. Mark compression algorithm: (compression means scanning again to prevent memory fragmentation and one more moving cost)

Memory efficiency: copy > mark clear > mark compress (time complexity)
Memory uniformity: copy = mark compression > mark clear
Memory utilization: Mark compression = mark clear > copy

For illustration and advantages and disadvantages of each algorithm mentioned above: https://www.cnblogs.com/qiang…
Reference for the differences between runtime constant pool, class constant pool and string constant pool: https://blog.csdn.net/zm13007…