You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2021/11/03 00:13:58 UTC
[incubator-teaclave] branch master updated: [WAMR] Fix leaked
resources (#569)
This is an automated email from the ASF dual-hosted git repository.
mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git
The following commit(s) were added to refs/heads/master by this push:
new 0ad267f [WAMR] Fix leaked resources (#569)
0ad267f is described below
commit 0ad267f2eabba17fca6fb01ec4c7dc2786d4813f
Author: Qinkun Bao <qu...@psu.edu>
AuthorDate: Tue Nov 2 17:13:49 2021 -0700
[WAMR] Fix leaked resources (#569)
---
executor/src/wamr.rs | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/executor/src/wamr.rs b/executor/src/wamr.rs
index c2e793e..f934733 100644
--- a/executor/src/wamr.rs
+++ b/executor/src/wamr.rs
@@ -91,6 +91,10 @@ extern "C" {
fn wasm_runtime_deinstantiate(module_inst: *const c_void);
+ fn wasm_runtime_unload(module: *const c_void);
+
+ fn wasm_runtime_destroy();
+
}
#[derive(Default)]
@@ -220,7 +224,6 @@ impl TeaclaveExecutor for WAMicroRuntime {
let result =
unsafe { wasm_runtime_call_wasm(exec_env, entry_func, wasm_argc, wasm_argv.as_ptr()) };
- reset_thread_context()?;
// clean WAMR allocated memory
let _ = p_argv
@@ -243,6 +246,12 @@ impl TeaclaveExecutor for WAMicroRuntime {
unsafe { wasm_runtime_deinstantiate(module_instance) };
+ unsafe { wasm_runtime_unload(module) };
+
+ unsafe { wasm_runtime_destroy() };
+
+ reset_thread_context()?;
+
result
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org