Skip to content

FinalizationRegistry resource leak? #648

Closed
@bnoordhuis

Description

@bnoordhuis

Opening so I don't forget.

There seems to be a leak caused by FinalizationRegistry. Apply this diff:

diff --git a/tests/test_builtin.js b/tests/test_builtin.js
index 4c29503..57c77ab 100644
--- a/tests/test_builtin.js
+++ b/tests/test_builtin.js
@@ -1047,6 +1047,7 @@ test_generator();
 test_proxy_iter();
 test_proxy_is_array();
 test_finalization_registry();
+throw "boom";
 test_exception_source_pos();
 test_function_source_pos();
 test_exception_prepare_stack();

And then:

$ build/qjs tests/test_builtin.js
boom
qjs: /home/bnoordhuis/src/quickjs/quickjs.c:2109: JS_FreeRuntime: Assertion `list_empty(&rt->gc_obj_list)' failed.
Aborted (core dumped)

The assert does not trigger when you throw before the call to test_finalization_registry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions