What is the meaning of “From Space” and “To Space” shown in jmap?

筅森魡賤 提交于 2021-01-18 05:17:04

问题


I understand the difference between new gen / old gen /perm gen, but I don't know what "To Space" and "From Space" are. I am seeing my "From Space" hitting 99.8% used while the "To Space" always seems to stay at 0% used.


回答1:


Two regions in the garbage-collection algorithm that is used in the VM.

Java specifics are found here: How Garbage Collection works in Java

And a general explanation about "from space" and "to space": WP

The most straightforward approach is the semi-space collector, which dates to 1969. In this moving GC scheme, memory is partitioned into a "from space" and "to space". Initially, objects are allocated into "to space" until they become full and a collection is triggered. At the start of a collection, the "to space" becomes the "from space", and vice versa. The objects reachable from the root set are copied from the "from space" to the "to space"

The reason why your "to space" is at 0% is, that only one of them is used except during collection; when the collection is done and all objs are in the "to space" then the names are swapped and the "to space" is now called the "from space".




回答2:


Different sources refer to these with various terminology: These are the Survivor "ping-pong" spaces as explained in https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/sizing.html

Another place calls them S0 and S1: https://codeahoy.com/2017/08/06/basics-of-java-garbage-collection/

JDK's jmap utility calls them "From Space" and "To Space".

P.S. PS in "PS Old Generation" stands for Parallel Scavenge



来源:https://stackoverflow.com/questions/15122502/what-is-the-meaning-of-from-space-and-to-space-shown-in-jmap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!