engine: mitigates memory leak (#1535)

Signed-off-by: inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
inkeliz
2023-06-26 05:41:51 +01:00
committed by GitHub
parent 102308d9d1
commit 451a1b63a0

View File

@@ -496,6 +496,13 @@ func (e *engine) Close() (err error) {
e.mux.Lock()
defer e.mux.Unlock()
// Releasing the references to compiled codes including the memory-mapped machine codes.
for i := range e.codes {
for j := range e.codes[i].functions {
e.codes[i].functions[j].parent = nil
}
}
e.codes = nil
return
}