alexcrichton opened PR #5656 from always-malloc-instance
to main
:
This commit removes the pooling of
Instance
allocations from the pooling instance allocator. This means that the allocation ofInstance
(andVMContext
) memory, now always happens through the systemmalloc
andfree
instead of optionally being part of the pooling instance allocator. Along the way this refactors theInstanceAllocator
trait so the pooling and on-demand allocators can share more structure with this new property of the implementation.The main rationale for this commit is to reduce the RSS of long-lived programs which allocate instances with the pooling instance allocator and aren't using the "next available" allocation strategy. In this situation the memory for an instance is never decommitted until the end of the program, meaning that eventually all instance slots will become occupied and resident. This has the effect of Wasmtime slowly eating more and more memory over time as each slot gets an instance allocated. By switching to the system allocator this should reduce the current RSS workload from O(used slots) to O(active slots), which is more in line with expectations.
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
alexcrichton requested fitzgen for a review on PR #5656.
fitzgen submitted PR review.
fitzgen submitted PR review.
alexcrichton updated PR #5656 from always-malloc-instance
to main
.
alexcrichton has enabled auto merge for PR #5656.
alexcrichton updated PR #5656 from always-malloc-instance
to main
.
alexcrichton merged PR #5656.
Last updated: Nov 22 2024 at 17:03 UTC