Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 819
juananneother Avatar asked Feb 27 '13 21:02

juananneother


People also ask

What happens when Eden space is full?

The Eden Space Empirical data and research shows that 98% of objects created are short lived. For these reasons, most newly created objects are allocated to the Eden space. When the eden space becomes full, minor gc takes place. During a minor GC event, objects surviving the eden space are moved to the survivor space.

What is JMAP command?

jmap is a command-line utility that is included in Linux® (but not Windows®) releases of the Java™ Development Kit (JDK). This utility prints memory–related statistics for a running JVM or core file. If jmap is used without any command-line options, then it prints the list of shared objects loaded.

How do I check my Java heap space?

You can verify that the JVM is using the increased Java heap space: Open a terminal window. Review the command output. The argument beginning with "-Xmx" will give you the value of the current Java heap space.


1 Answers

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".

like image 193
Bernd Elkemann Avatar answered Sep 28 '22 15:09

Bernd Elkemann