-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix HashStringAllocator::clear #10053
Conversation
This pull request was exported from Phabricator. Differential Revision: D58171132 |
✅ Deploy Preview for meta-velox canceled.
|
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.
Thanks.
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.
@arhimondr good catch. Thanks for the fix!
auto size = pair.second; | ||
pool()->free(pair.first, size); | ||
sizeFromPool_ -= size; | ||
cumulativeBytes_ -= size; |
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.
Can we add a check in ~HashStringAllocator to verify both sizeFromPool_ and cumulativeBytes_ are zero to help us to catch this sort of problem in production? The downside is that we might see crash but we should fix anyway? Thanks!
5d2744c
to
b867fc4
Compare
This pull request was exported from Phabricator. Differential Revision: D58171132 |
Summary: Decrement memory counters as in HashStringAllocator::freeToPool Reviewed By: xiaoxmeng, mbasmanova Differential Revision: D58171132
b867fc4
to
da59897
Compare
This pull request was exported from Phabricator. Differential Revision: D58171132 |
This pull request has been merged in 7fe89b4. |
Conbench analyzed the 1 benchmark run on commit There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Summary: Pull Request resolved: facebookincubator#10053 Decrement memory counters as in HashStringAllocator::freeToPool Reviewed By: xiaoxmeng, mbasmanova Differential Revision: D58171132 fbshipit-source-id: f87d411022b9b5cd9d996b4d999a7ab6c485171b
Summary: Pull Request resolved: facebookincubator#10053 Decrement memory counters as in HashStringAllocator::freeToPool Reviewed By: xiaoxmeng, mbasmanova Differential Revision: D58171132 fbshipit-source-id: f87d411022b9b5cd9d996b4d999a7ab6c485171b
Summary: Pull Request resolved: facebookincubator#10053 Decrement memory counters as in HashStringAllocator::freeToPool Reviewed By: xiaoxmeng, mbasmanova Differential Revision: D58171132 fbshipit-source-id: f87d411022b9b5cd9d996b4d999a7ab6c485171b
Summary: This PR solves the following issues: 1. `cumulativeBytes_` is the counter of allocated bytes, if we allocate n blocks and then execute free() on these blocks, the final value of `cumulativeBytes_` should be equal to 0. But without this PR, the value of `cumulativeBytes_` is not equal to 0. see `HashStringAllocatorTest#multipleFreeAncCheckCumulativeBytes` test case in this PR. This is because we don't include the size of the `Header` when calculating the allocated bytes. 2. When executing `HashStringAllocator::clear()`, we need to decrement memory counters. PR #10053 only decrement memory counters when releasing `allocationsFromPool_`. We also need to decrement the memory counters when releasing memory requested by `memory::AllocationPool`. 3. After executing `HashStringAllocator::clear()`, the values of `cumulativeBytes_` and `sizeFromPool_` should be equal to 0. CC: xiaoxmeng mbasmanova Pull Request resolved: #10260 Reviewed By: Yuhta Differential Revision: D59065411 Pulled By: xiaoxmeng fbshipit-source-id: 8f7913b0b89de69f88fa4d606c9628b31be38e3a
Summary: Decrement memory counters as in HashStringAllocator::freeToPool
Differential Revision: D58171132