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

Fix HashStringAllocator::clear #10053

Closed
wants to merge 1 commit into from

Conversation

arhimondr
Copy link
Contributor

Summary: Decrement memory counters as in HashStringAllocator::freeToPool

Differential Revision: D58171132

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58171132

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Jun 5, 2024
Copy link

netlify bot commented Jun 5, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit da59897
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6660e387e355ea00085a5867

Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

Thanks.

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a 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!

velox/common/memory/HashStringAllocator.cpp Outdated Show resolved Hide resolved
auto size = pair.second;
pool()->free(pair.first, size);
sizeFromPool_ -= size;
cumulativeBytes_ -= size;
Copy link
Contributor

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!

@facebook-github-bot
Copy link
Contributor

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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58171132

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 7fe89b4.

Copy link

Conbench analyzed the 1 benchmark run on commit 7fe89b4f.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Joe-Abraham pushed a commit to Joe-Abraham/velox that referenced this pull request Jun 7, 2024
Summary:
Pull Request resolved: facebookincubator#10053

Decrement memory counters as in HashStringAllocator::freeToPool

Reviewed By: xiaoxmeng, mbasmanova

Differential Revision: D58171132

fbshipit-source-id: f87d411022b9b5cd9d996b4d999a7ab6c485171b
Joe-Abraham pushed a commit to Joe-Abraham/velox that referenced this pull request Jun 7, 2024
Summary:
Pull Request resolved: facebookincubator#10053

Decrement memory counters as in HashStringAllocator::freeToPool

Reviewed By: xiaoxmeng, mbasmanova

Differential Revision: D58171132

fbshipit-source-id: f87d411022b9b5cd9d996b4d999a7ab6c485171b
deepashreeraghu pushed a commit to deepashreeraghu/velox that referenced this pull request Jun 13, 2024
Summary:
Pull Request resolved: facebookincubator#10053

Decrement memory counters as in HashStringAllocator::freeToPool

Reviewed By: xiaoxmeng, mbasmanova

Differential Revision: D58171132

fbshipit-source-id: f87d411022b9b5cd9d996b4d999a7ab6c485171b
facebook-github-bot pushed a commit that referenced this pull request Jun 29, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants