fixed the garbage collection of async functions with closures (github issue #156)

This commit is contained in:
Fabrice Bellard
2023-12-27 17:21:46 +01:00
parent 399d916e66
commit 7414e5f67f
2 changed files with 302 additions and 247 deletions

View File

@@ -270,6 +270,26 @@ function test_timer()
os.clearTimeout(th[i]);
}
/* test closure variable handling when freeing asynchronous
function */
function test_async_gc()
{
(async function run () {
let obj = {}
let done = () => {
obj
std.gc();
}
Promise.resolve().then(done)
const p = new Promise(() => {})
await p
})();
}
test_printf();
test_file1();
test_file2();
@@ -279,3 +299,5 @@ test_os();
test_os_exec();
test_timer();
test_ext_json();
test_async_gc();