I've been experimenting with jmap -histo
and jmap -dump
today
When run in this sequence
jmap -dump:format=b,file=heap.1 [pid]
jmap -dump:live,format=b,file=heap.2 [pid]
jmap -dump:format=b,file=heap.3 [pid]
heap.3
resembles heap.2
more than heap.1
. In particular, the "dead" objects that I'm interested in in heap.1
are absent from heap.3
.
Seeing this, I started looking for documentation that would tell me what I should expect. The closest I managed to get was this discussion, where the comments from briand and alanb imply that in practice I can expect this GC to occur when I use the live option; but the answers are five years old, and posts to a forum seem a bit informal for a specification.
Where can I find the current behavior documented?
In order to determine liveness, Java has to run full GC, so yes, it does.
To put the question to sleep... here is the answer, if anyone needs to dig deeper. Feel free.
part of /hotspot/agent/src/share/vm/services/attachListener.cpp taken from
openjdk http://download.java.net/openjdk/jdk7/ and you must accept http://www.gnu.org/licenses/gpl-2.0.html
in vmGCOperations.hpp it's the definition