/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/napi/wrap_leak.js
17 строк
656 B
Bartek Iwańczuk
fix(ext/napi): call wrap/ref finalizers at shutdown (#32592)
12 мар 2026, 19:07
Не верифицирован
12 мар 2026, 19:07
aa6ee7d
Код
Авторство
О чём код?
// Copyright 2018-2026 the Deno authors. MIT license. // Test that napi_wrap finalizers run at shutdown even when the wrapped // JS object is still reachable (not garbage collected). This matches // Node.js behavior where weak reference cleanup happens during // napi_env::DeleteMe(). import { loadTestLibrary } from "./common.js"; const lib = loadTestLibrary(); // Create an object and wrap it with a native finalizer. // Keep the reference alive (in global scope) so GC won't collect it. const _leaked = lib.test_wrap_leak({}); // The process exits naturally here. The wrap finalizer should still // be called during shutdown, printing the message.