Skip to content

Commit 0a70623

Browse files
authored
Move "no more objects" assert to right place (#649)
No test because I can only get it to trigger with qjs, not run-test262, but the problem is that we need to run FinalizationRegistry finalizers before asserting no objects remain. Fixes: #648
1 parent 37fe427 commit 0a70623

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

quickjs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,6 @@ void JS_FreeRuntime(JSRuntime *rt)
21062106
printf("Secondary object leaks: %d\n", count);
21072107
}
21082108
#endif
2109-
assert(list_empty(&rt->gc_obj_list));
21102109

21112110
/* free the classes */
21122111
for(i = 0; i < rt->class_count; i++) {
@@ -2237,6 +2236,9 @@ void JS_FreeRuntime(JSRuntime *rt)
22372236
js_free_rt(rt, fs);
22382237
}
22392238

2239+
// FinalizationRegistry finalizers have run, no objects should remain
2240+
assert(list_empty(&rt->gc_obj_list));
2241+
22402242
{
22412243
JSMallocState *ms = &rt->malloc_state;
22422244
rt->mf.js_free(ms->opaque, rt);

0 commit comments

Comments
 (0)