Skip to content

Conversation

alexcrichton
Copy link
Member

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.

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.
@alexcrichton alexcrichton requested a review from a team as a code owner October 3, 2025 22:15
@alexcrichton alexcrichton requested review from fitzgen and removed request for a team October 3, 2025 22:15
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Oct 4, 2025
Comment on lines +605 to +608
self.stripes
.iter()
.map(|i| i.allocator.unused_warm_slots())
.sum()
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

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.

@alexcrichton alexcrichton enabled auto-merge October 6, 2025 15:06
@alexcrichton alexcrichton added this pull request to the merge queue Oct 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:api Related to the API of the `wasmtime` crate itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants