Skip to content

Garbage collection error when trying to dispose of date in array #41

@AashJ

Description

@AashJ
  test.only("Date in array", async () => {
    const ctx = (await getQuickJS()).newContext();
    const arena = new Arena(ctx, { isMarshalable: true });
    const scope = { results: [new Date(2022, 7, 26)] };
    arena.expose(scope);

    const evalResult = arena.evalCode("results[0]");
    console.log(evalResult);
    expect(evalResult).instanceOf(Date);

    arena.dispose();
    ctx.dispose();
  });

When running this test, an error is thrown:

RuntimeError: Aborted(Assertion failed: list_empty(&rt->gc_obj_list), at: quickjs/quickjs.c,1983,JS_FreeRuntime). Build with -s ASSERTIONS=1 for more info.

My best guess is the quickjs handle isn't being properly disposed of, but i'm not 100% sure. Working on a PR, but thought I'd flag here incase anyone had ideas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions