Skip to content

Conversation

@LinHu2016
Copy link
Contributor

@LinHu2016 LinHu2016 commented Sep 10, 2025

Previous PR #17107 target
to prevent exception "committed argument cannot be less than 0" for
MemoryPool "balanced-reserved" during collecting memoryUsage at the end
of GC(balanced GC only), but there are two special cases haven't been
covered.

Fix case 1: maxHeapExpansionRegions could add on maxEdenChange and use
_extensions->globalVLHGCStats._heapSizingData.edenRegionChange to notify
heap resize to adjust heap size to match eden change, but it did not
consider the case which eden size is bigger than free memory, so update
_extensions->globalVLHGCStats._heapSizingData.edenRegionChange =
OMR_MIN(maxHeapExpansionRegions, edenChangeWithSurvivorHeadroom +
(intptr_t)(_edenRegionCount - freeRegions));
for keeping free memory >= eden size after heap resize.

Fix case 2: eden region can not be smaller than 1, when free region is 0
eden region size can be 0.

Add Assertion checks to confirm free size >= eden size.

Update to correct freeTenure at the beginning of PGC
should count out free eden size(for most case, free eden would be
closed to 0, but in some cases free eden is significant, it might
confuse the heap resize algorithm).

fix: #22440
depend: eclipse-omr/omr#8063

Signed-off-by: lhu linhu@ca.ibm.com


incrementRegionAges(env, _taxationThreshold, true);

verifyHeapSizing(env);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not insisting, but I don't see a point to have this helper (contains single assertion only). In the case of triggering C-stack is required to figure out which of two places was problematic. I think using assertion directly is more informative.

@LinHu2016 LinHu2016 force-pushed the pmr_committedsizeisssue branch from 47eef92 to 61983df Compare October 17, 2025 15:29
@LinHu2016 LinHu2016 force-pushed the pmr_committedsizeisssue branch 4 times, most recently from e0303db to e02d8a0 Compare December 2, 2025 17:11
@LinHu2016 LinHu2016 force-pushed the pmr_committedsizeisssue branch 3 times, most recently from 653907b to b4057e0 Compare January 6, 2026 18:24
Previous PR eclipse-openj9#17107 target
to prevent exception "committed argument cannot be less than 0" for
MemoryPool "balanced-reserved" during collecting memoryUsage at the end
of GC(balanced GC only), but there are two special cases haven't been
covered.

Fix case 1: maxHeapExpansionRegions could add on maxEdenChange and use
_extensions->globalVLHGCStats._heapSizingData.edenRegionChange to notify
heap resize to adjust heap size to match eden change, but it did not
consider the case which eden size is bigger than free memory, so update
_extensions->globalVLHGCStats._heapSizingData.edenRegionChange =
OMR_MIN(maxHeapExpansionRegions, edenChangeWithSurvivorHeadroom +
(intptr_t)(_edenRegionCount - freeRegions));
 for keeping free memory >= eden size after heap resize.

Fix case 2: eden region can not be smaller than 1, when free region is 0
eden region size can be 0.

Add Assertion checks to confirm free size >= eden size.

Update to correct freeTenure at the beginning of PGC

should count out free eden size(for most case, free eden would be
closed to 0, but in some cases free eden is significant, it might
confuse the heap resize algorithm).

Signed-off-by: lhu <linhu@ca.ibm.com>
@LinHu2016 LinHu2016 force-pushed the pmr_committedsizeisssue branch from b4057e0 to 133f6cb Compare January 14, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants