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:
@@ -46,6 +46,9 @@ func (e *engine) getCompiledModule(module *wasm.Module, listeners []experimental
|
|||||||
cm.functions[i].listener = listeners[i]
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user