Please sign in to comment.
Don't remove finalized objects from remember set
With concurrent GC this can cause problems. The issue is that the concurrent mark stack still has a reference to an object that makes this finalized object reachable. This is because the concurrent GC started when the object was still reachable and not yet scheduled for finalization. The finalization itself is fine here and not problematic, but the problem occurs when it's removed from the remember set. This finalized mature object might hold references to young objects. If during the time of the mature mark phase, we run additional young GC's, these references become invalid since the finalized object is no longer remembered. Not removing this from the remember set ensures we keep updating these young objects so they stay reachable for the concurrent marking phase. This results in these objects staying alive somewhat longer than necessary, namely until the next mature GC phase. There is however no way around this since we need to ensure that during concurrent marking, no objects go out of scope that are still reachable in some form.
- Loading branch information...