compiler: add munmap finalizer on cache hits to avoid memory leak (#1815)

Signed-off-by: Val Packett <val@packett.cool>
This commit is contained in:
Val Packett
2023-10-25 05:01:01 -03:00
committed by GitHub
parent 610fdbd664
commit 99c057bcb5

View File

@@ -46,6 +46,9 @@ func (e *engine) getCompiledModule(module *wasm.Module, listeners []experimental
cm.functions[i].listener = listeners[i]
}
}
// As this uses mmap, we need to munmap on the compiled machine code when it's GCed.
e.setFinalizer(cm, releaseCompiledModule)
}
return
}