🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@nxtedition/shared

Package Overview
Dependencies
Maintainers
10
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nxtedition/shared - npm Package Compare versions

Comparing version
5.0.5
to
5.0.6
+2
-2
package.json
{
"name": "@nxtedition/shared",
"version": "5.0.5",
"version": "5.0.6",
"type": "module",

@@ -49,3 +49,3 @@ "main": "lib/index.js",

},
"gitHead": "a58d43fbac9afd98840f23588497be3184bf874c"
"gitHead": "4990fe6fb6e2a6cde434759f8e511d75a1ef078f"
}

@@ -411,7 +411,11 @@ #define NAPI_EXPERIMENTAL

// Environment cleanup hook that releases the initial ring_buf_t reference held
// by the SAB-creating environment. Fires when that environment closes (e.g.
// process exit), so ring_buf_t and the mmap region are freed once all per-AB
// references have also been released.
static void sab_cleanup_hook(void *arg) { ring_buf_release(static_cast<ring_buf_t *>(arg)); }
// Finalizer attached via napi_wrap to the SharedArrayBuffer returned by
// ring_alloc. Releases the initial ring_buf_t reference when the SAB is GC'd
// in the creating context.
// NOTE: workaround for missing napi_create_external_shared_array_buffer;
// see https://github.com/nodejs/node/issues/62259
static void sab_finalizer(node_api_basic_env /*env*/, void *finalize_data, void * /*finalize_hint*/)
{
ring_buf_release(static_cast<ring_buf_t *>(finalize_data));
}

@@ -426,6 +430,4 @@ // ─── NAPI methods ─────────────────────────────────────────────────────────────

// TODO (fix): NAPI has no napi_create_external_shared_array_buffer so we use
// node_api_create_sharedarraybuffer (V8-managed SAB memory) as a workaround.
// The initial ring_buf_t reference is released via sab_cleanup_hook when the
// creating environment closes. Once upstream adds external SAB support this
// can be simplified: https://github.com/nodejs/node/issues/62259
// node_api_create_sharedarraybuffer as a workaround. Once upstream adds external
// SAB support this can be simplified: https://github.com/nodejs/node/issues/62259
static napi_value ring_alloc(napi_env env, napi_callback_info info)

@@ -476,5 +478,7 @@ {

// TODO (fix): We are leaking the initial ring_buf_t reference. We are missing
// napi_create_external_shared_array_buffer which would allow us to attach a
// finalizer to the SAB itself.
// Attach a finalizer to the SAB so the initial ring_buf_t reference is
// released when the SAB is GC'd in this context. Workers that receive the
// SAB get their own JS object wrapping the same backing store but do not
// carry this wrap, so their lifetime is handled by ring_get_array_buffer.
napi_wrap(env, sab, rb, sab_finalizer, nullptr, nullptr);

@@ -481,0 +485,0 @@ uint32_t *s = static_cast<uint32_t *>(state_data);