-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Released memory retained by ExchangeSource #11097
Conversation
// If the data source has been closed in a meantime reset memory usage back to 0 | ||
if (closed) { | ||
systemMemoryContext.setBytes(0); | ||
} |
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.
Why is this check needed? systemMemoryContext.setBytes(0);
will always be executed in the finally
block of close()
, right?
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.
Yes, but pollPage
and close
can be called concurrently. It is possible that close
will set the memory reservation to 0
while the pollPage
will reset it back to a non zero value
Typo in commit message "Released" -> "Release" |
// It is modified (assigned to null) when the ExchangeOperator is closed. | ||
// It doesn't have to be declared as volatile as the nullification of this variable doesn't have to be immediately visible to other threads. | ||
// However since close can be called at any moment this variable has to be accessed in a safe way (avoiding "check-then-use"). | ||
private ExchangeSource exchangeSource; |
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.
There two separate issues here. One improving GC and another is ensuring memory pool accounting is fine. It would be nice to have separated commits for them.
b7d7dda
to
d023e5b
Compare
CI: #11140 |
CI: #4936 |
Description
Avoid retaining memory used by ExchangeSource more than necessary
Improvement
Core engine
Non user visible improvement
Related issues, pull requests, and links
Documentation
(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
(x) No release notes entries required.
( ) Release notes entries required with the following suggested text: