Add some more metrics to the pooling allocator#11789
Merged
alexcrichton merged 6 commits intobytecodealliance:mainfrom Oct 7, 2025
Merged
Add some more metrics to the pooling allocator#11789alexcrichton merged 6 commits intobytecodealliance:mainfrom
alexcrichton merged 6 commits intobytecodealliance:mainfrom
Conversation
This commit adds a few more metrics to the `PoolingAllocatorMetrics` type along the lines of accounting for more items as well as the unused slots in the pooling allocator. Notably the count of unused memory and table slots is exposed along with the number of bytes which are kept resident in these slots despite them not being in use. This involved a bit of plumbing to thread around the number of bytes that are actually kept resident to some more locations but is otherwise a pretty straightforward plumbing of accounting information we already had internally.
pchickey
approved these changes
Oct 3, 2025
lann
reviewed
Oct 6, 2025
Comment on lines
+605
to
+608
| self.stripes | ||
| .iter() | ||
| .map(|i| i.allocator.unused_warm_slots()) | ||
| .sum() |
Contributor
There was a problem hiding this comment.
I avoided this iteration + locking out of a (I guess probably irrational) fear of contention under heavy parallel load. Is that a pretty negligible concern here? If not, should we make a note about it in the pub method docs?
Member
Author
There was a problem hiding this comment.
I'll make a note yeah. My prediction is that it won't be too costly, but if it ends up causing problems we can probably work around it with atomic counters.
prtest:full
bongjunj
pushed a commit
to prosyslab/wasmtime
that referenced
this pull request
Oct 20, 2025
* Add some more metrics to the pooling allocator This commit adds a few more metrics to the `PoolingAllocatorMetrics` type along the lines of accounting for more items as well as the unused slots in the pooling allocator. Notably the count of unused memory and table slots is exposed along with the number of bytes which are kept resident in these slots despite them not being in use. This involved a bit of plumbing to thread around the number of bytes that are actually kept resident to some more locations but is otherwise a pretty straightforward plumbing of accounting information we already had internally. * Fix configured build * Add some docs * Only run new test on Linux * Try to fix ASAN prtest:full * Shrink pooling size in tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds a few more metrics to the
PoolingAllocatorMetricstype along the lines of accounting for more items as well as the unused slots in the pooling allocator. Notably the count of unused memory and table slots is exposed along with the number of bytes which are kept resident in these slots despite them not being in use. This involved a bit of plumbing to thread around the number of bytes that are actually kept resident to some more locations but is otherwise a pretty straightforward plumbing of accounting information we already had internally.