-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear Inactive Objects at Checkpoint #7176
Conversation
d7919b1
to
dc3a0e0
Compare
Comparison with original commit shows the changes in ParallelGlobalGC.cpp (and some other non GC changes due different baseline), where locals MM_GCCode *gcCode and MM_GlobalGCStats *stats are now correctly used as pointers. |
dc3a0e0
to
5873e7c
Compare
/* If the delegate has isAllowUserHeapWalk set, or should prepare for a snapshot, | ||
* fix the heap so that it can be walked | ||
*/ | ||
MM_GCCode *gcCode = &env->_cycleState->_gcCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can actually use a snapshot of gcCode (rather than a pointer to it) - we don't really change gcCode in a middle of a GC - it's just set by whoever triggered GC.
So you can declare it as:
const MM_GCCode gcCode
note that there is another user of it at around of line 571
5873e7c
to
c1c546f
Compare
/* If the delegate has isAllowUserHeapWalk set, or should prepare for a snapshot, | ||
* fix the heap so that it can be walked | ||
*/ | ||
const MM_GCCode gcCode = env->_cycleState->_gcCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more that you can use it at line 514 (hence move the declaration of gcCode at the start of the method)
@@ -478,7 +511,7 @@ MM_ParallelGlobalGC::mainThreadGarbageCollect(MM_EnvironmentBase *env, MM_Alloca | |||
_collectionStatistics._tenureFragmentation |= MACRO_FRAGMENTATION; | |||
} | |||
|
|||
mainThreadCompact(env, allocDescription, rebuildMarkBits); | |||
mainThreadCompact(env, allocDescription, rebuildMarkBits || env->_cycleState->_gcCode.shouldClearHeap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add a comment here
while normally mark map is not required for walking the heap after a compact, the clearing callback asserts that everything that is not cleared is a marked object, so we need to rebuild a mark map for clearing
When a checkpoint is taken, the entire contents of the process is serialized, and someone can inspect the serialized state to capture some sensitive info. Solution: If a data is no longer referenced, the entire memory chunk is zeroed at snapshot time. Implementation detail: After the initial snapshot GC, 2 passes are done to fix-up, identify, and clear all unused free memory chunks (including both linked and unlinked multi-slot free entries). The first pass performs a fix-up to the current heap which converts dark matter to holes, while the second pass clears all free entries. Note here this implementation only works for standard GC but not balanced GC and metronome. Signed off by: [email protected]
c1c546f
to
7c33b95
Compare
@babsingh please proceed with final review |
It's a resubmit of #7159, with a functional change how local MM_GlobalGCStats *stats was used, plus a couple of minor non-functional changes. |
jenkins build all |
When a checkpoint is taken, the entire contents of the process is serialized, and someone can inspect the serialized state to capture some sensitive info.
Solution:
If a data is no longer referenced, the entire memory chunk is zeroed at snapshot time.
Implementation detail:
After the initial snapshot GC, 2 passes are done to fix-up, identify, and clear all unused free memory chunks (including both linked and unlinked multi-slot free entries). The first pass performs a fix-up to the current heap which converts dark matter to holes, while the second pass clears all free entries.
Note here this implementation only works for standard GC but not balanced GC and metronome.
Signed off by: [email protected]