quickjs-emscripten-sync icon indicating copy to clipboard operation
quickjs-emscripten-sync copied to clipboard

Unset all values created in arena

Open tim-field opened this issue 6 months ago • 0 comments

Currently a call to arena dispose doesn't remove variables from the context.

const arena1 = new Arena(vm, {
    isMarshalable: 'json'
})
arena1.expose({foo: 'bar'})
arena1.evalCode(`return foo`) // returns bar as expect
arena1.dispose()


const arena2 = new Arena(vm, {
    isMarshalable: 'json'
})
// I wasn't existing this to work after the dispose above
arena2.evalCode(`return foo`) // returns 'bar' unexpected

Is it possible to reset the arena? I'd like to share context between executions, as we apply polyfills to the run time, this takes a long time so I was trying to share the context between a few different evaluations.

tim-field avatar Jul 31 '24 02:07 tim-field