Skip to content
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

Garbage collect on allocation exceeding max memory pool size #9846

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

roberttoyonaga
Copy link
Collaborator

Summary

Garbage collection is currently done on the allocation slow path after the max eden size was already exceeded by a previous allocation. For example, if new TLAB allocationA causes the max size to be exceeded, the pool max size will remain exceeded until new TLAB allocationB happens. It would be better to do GC when the allocation that actually causes the threshold to be exceeded happens.

This is because, on the slow path, maybeCollectOnAllocation is called too early. maybeCollectOnAllocation calls shouldCollectOnAllocation which checks whether the eden size threshold is exceeded.
The problem is that maybeCollectOnAllocation is called before increaseEdenUsedBytes is called, so shouldCollectOnAllocation doesn't take into account the size of the current allocation. Is there a reason for this, or is this a bug?

I've just made a small change so that shouldCollectOnAllocation takes into account the size of the current allocation that is requiring a new TLAB (and potentially causing the memory pool max to be exceeded).

See #6930 for more context.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 8, 2024
@roberttoyonaga roberttoyonaga added native-image redhat-interest and removed OCA Verified All contributors have signed the Oracle Contributor Agreement. labels Oct 8, 2024
@roberttoyonaga roberttoyonaga marked this pull request as ready for review October 8, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant