napi-rs/crates/napi/src
Louis 9391196eef
fix(napi): prevent memory leak when Custom GC is used (#1963)
There is a piece of custom logic that has been added a while back to ensure
that Buffers can be sent across threads, and be dropped properly. This involves
a custom GC that runs on NodeJS's current thread (per my understanding). The
logic to drop the buffer on that custom GC differed from the one in the Drop
impl. This meant that everytime Node sent a buffer back to a napi-rs function,
the reference wouldn't be cleaned up properly, and it would leak (96 bytes per
Reference on an ARM MacOS machine).

This commit updates the logic in the custom GC so that it matches the one in
the Drop impl. This worked locally, and fixed any occurence of the leak I could
find.
2024-02-20 20:36:21 +08:00
..
bindgen_runtime fix(napi): prevent memory leak when Custom GC is used (#1963) 2024-02-20 20:36:21 +08:00
js_values fix(napi-derive): JsArrayBuffer generated type 2024-01-26 14:32:24 +08:00
async_cleanup_hook.rs Introduce #[napi] procedural macro to automation development boilerplate (#696) 2021-09-23 01:29:09 +08:00
async_work.rs chore: fix async_work status typo (#1883) 2024-01-02 13:23:45 +08:00
call_context.rs refactor(napi): remove compatible Either struct 2021-11-25 17:53:41 +08:00
cleanup_env.rs Introduce #[napi] procedural macro to automation development boilerplate (#696) 2021-09-23 01:29:09 +08:00
env.rs fix(napi): Fix buffer corruption and soundness issues (#1923) 2024-01-29 18:32:28 +08:00
error.rs feat(napi,sys): sync to napi9 (#1781) 2023-11-06 11:00:27 +08:00
lib.rs fix: remove outdated rustdoc about tokio channels (#1961) 2024-02-20 16:36:29 +08:00
status.rs fix(napi): support custom status in Error (#1486) 2023-02-09 23:18:57 +08:00
task.rs feat(napi): implement AsyncTask with AbortSignal support 2021-11-06 13:51:54 +08:00
threadsafe_function.rs fix(napi): move JsValuesTupleIntoVec trait to function.rs 2024-01-26 14:32:24 +08:00
tokio_runtime.rs fix(napi): future in block_on do not need to be send 2024-01-24 17:20:31 +08:00
value_type.rs feat(napi): BigInt codegen support 2021-11-11 16:18:25 +08:00
version.rs fix(napi): correct the CString usage 2021-11-15 16:55:13 +08:00