File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -237,23 +237,25 @@ func (in *Instance) SetContextStorage(s runtime.Storage) {
237
237
in .ctx .Storage = s
238
238
}
239
239
240
- // Stop closes the instance (wasm instance and its imports)
241
- // in a thread-safe way.
240
+ // Stop closes the WASM instance, its imports and clears
241
+ // the context allocator in a thread-safe way.
242
242
func (in * Instance ) Stop () {
243
243
in .mutex .Lock ()
244
244
defer in .mutex .Unlock ()
245
245
in .close ()
246
246
}
247
247
248
248
// close closes the wasm instance (and its imports)
249
- // if the instance has not been previously closed.
249
+ // and clears the context allocator. If the instance
250
+ // has previously been closed, it simply returns.
250
251
// It is NOT THREAD SAFE to use.
251
252
func (in * Instance ) close () {
252
253
if in .isClosed {
253
254
return
254
255
}
255
256
256
257
in .vm .Close ()
258
+ in .ctx .Allocator .Clear ()
257
259
in .isClosed = true
258
260
}
259
261
You can’t perform that action at this time.
0 commit comments