fridaymore opened PR #10484 from fridaymore:main
to bytecodealliance:main
:
We are troubleshooting performance / scaling issues in our project that uses Wasmtime and Pooling Allocation was recommended. Currently, we are not able to enable Pooling Allocation through the C API.
Note, the
memory-protection-keys
feature is not enabled for the C API, so that block is always ignored.
fridaymore requested dicej for a review on PR #10484.
fridaymore requested wasmtime-core-reviewers for a review on PR #10484.
fridaymore updated PR #10484.
alexcrichton submitted PR review:
Thanks! Would you be up for refactoring this to use an object-style API along the lines of
wasm_config_t
where a newwasmtime_pooling_config_t
object was added and the properties here are functions to configure each field? That way it's possible to configure just a single option while leaving all the others at their defaults, while currently it would require configuring all options at the same time.Additionally as a minor thing, mind putting
#ifdef
guards around these definitions for the pooling allocator cfg being turned on?
fridaymore updated PR #10484.
fridaymore commented on PR #10484:
Thanks! Would you be up for refactoring this to use an object-style API along the lines of
wasm_config_t
where a newwasmtime_pooling_config_t
object was added and the properties here are functions to configure each field? That way it's possible to configure just a single option while leaving all the others at their defaults, while currently it would require configuring all options at the same time.Additionally as a minor thing, mind putting
#ifdef
guards around these definitions for the pooling allocator cfg being turned on?Thanks - I switched to an object-style API and added the
#ifdef
guards for feature gating. Can you opine on memory management forwasmtime_pooling_config_t
? I am assuming I need to provide a way to free the memory that was allocated on the heap?
fridaymore edited PR #10484:
We are troubleshooting performance / scaling issues in our project that uses Wasmtime and Pooling Allocation was recommended. Currently, we are not able to enable Pooling Allocation through the C API.
alexcrichton commented on PR #10484:
Yeah adding a free method for it I think is the way to go. Otherwise "cloning out" the configuration makes sense to me as well.
Mind also adding
wasmtime_*
prefixes to the methods/types here too?
fridaymore updated PR #10484.
fridaymore updated PR #10484.
fridaymore edited PR #10484:
We are troubleshooting performance / scaling issues in our project that uses Wasmtime and Pooling Allocation was recommended. Currently, we are not able to enable Pooling Allocation through the C API.
Note: mpk options are not exposed.
fridaymore commented on PR #10484:
Pushed some changes, please take another look.
alexcrichton submitted PR review:
Thanks! Just some minor things here and there, but otherwise looks good
alexcrichton created PR review comment:
Mind adding a
// WASMTIME_FEATURE_POOLING_ALLOCATOR
here to indicate which#ifdef
it's closing?
alexcrichton created PR review comment:
For this I think the second argument can be
const wasmtime_pooling_allocation_config_t*
to reflect how it doesn't mutate it.
alexcrichton created PR review comment:
Can you add some documentation to these functions/types? Just some basic docs is fine, but for example indicating that
*_new()
must be deallocated with*_delete()
and perhaps linking to the Rust documentation forwasmtime_pooling_allocation_config_t
.Also for
wasmtime_pooling_allocation_strategy_set
down below can you document that it doesn't take ownership of the pooling config and the pooling config still needs to be manually deleted?
fridaymore updated PR #10484.
fridaymore submitted PR review.
fridaymore created PR review comment:
Done
fridaymore submitted PR review.
fridaymore created PR review comment:
Done
fridaymore submitted PR review.
fridaymore created PR review comment:
Done
fridaymore requested alexcrichton for a review on PR #10484.
alexcrichton submitted PR review.
fridaymore updated PR #10484.
alexcrichton has enabled auto merge for PR #10484.
alexcrichton merged PR #10484.
Last updated: Apr 17 2025 at 17:03 UTC