You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all!
My AssemblyScript wasm app call some native API which implemented by wasm runtime,
and some native_api_free() API must be called manually to free some native resource by AssemblyScript wasm
app when there is no need to use it, otherwise it will cause memory leak problem.
export function _start(): void {
// call native api which implemented by webassembly runtime
var stringInstance = covertToString(nativeApi());
// add a listener to listen this object's lifecycle
stringInstance.addGCListener(gcCallbackMethod(stringInstance));
}
function gcCallbackMethod(inst: string) {
// when this object is being free, call nativeAPIFree() to free some native resource so that developer not need to free it manually.
nativeApiFree(inst);
}
For some reason, it's hard to free it manually. Is it possible to add a GC callback listener to a new AssemblyScript object? So when it is free(GCed), we can receive a GC callback message about this object, then call native_api_free() to free some native resources. Thanks.
The text was updated successfully, but these errors were encountered:
I understand that means we should execute AssemblyScript on runtime like chrome, which we AssemblyScript module(wasm) from javascript? Currently my wasm app(written by AssemblyScript) run on wasm-micro-runtime. not sure I understand correctly, thanks.
Hi all!
My AssemblyScript wasm app call some native API which implemented by wasm runtime,
and some native_api_free() API must be called manually to free some native resource by AssemblyScript wasm
app when there is no need to use it, otherwise it will cause memory leak problem.
For some reason, it's hard to free it manually. Is it possible to add a GC callback listener to a new AssemblyScript object? So when it is free(GCed), we can receive a GC callback message about this object, then call native_api_free() to free some native resources. Thanks.
The text was updated successfully, but these errors were encountered: