Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(napi): free buffer in current thread if env is available #1549

Merged
merged 1 commit into from Mar 30, 2023

Conversation

Brooooooklyn
Copy link
Sponsor Member

@Brooooooklyn Brooooooklyn commented Mar 29, 2023

I can confirm the double free error no longer occurred after I applied this patch to @parcel/sourcemap and @parcel/hash with PARCEL_WORKERS=64 yarn build.

The root cause is that Buffer and TypedArray are not zero overhead, as they bring many boundary condition processing in async context, which is a design issue. I am considering providing &[u8/i8/...] as a parameter to represent pure JavaScript TypedArray. If in synchronous usage scenarios like @parcel/hash and @parcel/sourcemap, the best option currently is to use JsBuffer to avoid unnecessary runtime performance degradation.

/cc @devongovett

@Brooooooklyn Brooooooklyn force-pushed the double-free-buffer branch 2 times, most recently from 372f947 to 7f32d6d Compare March 30, 2023 04:06
@Brooooooklyn Brooooooklyn merged commit 0a6b214 into main Mar 30, 2023
33 checks passed
@Brooooooklyn Brooooooklyn deleted the double-free-buffer branch March 30, 2023 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation faults in napi v2.10.3 and later
1 participant