mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 05:37:58 +00:00
Decommit instance memory after a runtime call on Linux (#8998)
* Decommit instance memory after a runtime call on Linux * Update documentation for the test * Remove unfinished comment * Use saturating_sub. Also update the doc comment. * Precise RSS tracking in the test Instead of tracking RSS for the whole process we just look at the particular mapping that is associated with the linear memory of the runtime instance * Remove unused import * Fix unused imports * Fix the unused imports error for good * Rollback an accidental change to benches * Fix the test * Remove now unneeded code
This commit is contained in:
@@ -150,7 +150,13 @@ impl WasmInstance for WasmtimeInstance {
|
||||
globals_snapshot.apply(&**instance_wrapper);
|
||||
let allocator = FreeingBumpHeapAllocator::new(*heap_base);
|
||||
|
||||
perform_call(data, Rc::clone(&instance_wrapper), entrypoint, allocator)
|
||||
let result = perform_call(data, Rc::clone(&instance_wrapper), entrypoint, allocator);
|
||||
|
||||
// Signal to the OS that we are done with the linear memory and that it can be
|
||||
// reclaimed.
|
||||
instance_wrapper.decommit();
|
||||
|
||||
result
|
||||
}
|
||||
Strategy::RecreateInstance(instance_creator) => {
|
||||
let instance_wrapper = instance_creator.instantiate()?;
|
||||
@@ -173,6 +179,19 @@ impl WasmInstance for WasmtimeInstance {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn linear_memory_base_ptr(&self) -> Option<*const u8> {
|
||||
match &self.strategy {
|
||||
Strategy::RecreateInstance(_) => {
|
||||
// We do not keep the wasm instance around, therefore there is no linear memory
|
||||
// associated with it.
|
||||
None
|
||||
}
|
||||
Strategy::FastInstanceReuse {
|
||||
instance_wrapper, ..
|
||||
} => Some(instance_wrapper.base_ptr()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Prepare a directory structure and a config file to enable wasmtime caching.
|
||||
|
||||
Reference in New Issue
Block a user