John M McIntosh writes:
If you do the fullGC, then the fork and snapshot which also does a fullGC, then cleans up context records and information about primitive linkups you should find that the amount of memory altered is much less. The problem with doing a snapshot at any point is that it most likely will move *most* memory in the image as it compacts the image as a result of the full GC. Back to Back full GCs won't move anything (depending on if the interpreter runs between calls). Thus altering much less memory.
However the fullGC would still tag every live object thus forcing the pages to be copied.
Couldn't the fullGC be replaced by a scan clearing root objects? That would only need to change the roots not everything. There'll never be that many root objects.
If the global GC that removes the root method context's is done in the image what stops the code between it and the snapshot from promoting another method context? I can see how an image side GC could reduce the size of the risk, but unless no GCs happen between the full GC and the snapshot surely there's still some risk now?
Bryce