-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
buffer: FreeCallback should be tied to ArrayBuffer #3198
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
buffer: FreeCallback should be tied to ArrayBuffer #3198
Conversation
|
@bnoordhuis I wonder if it may be a good opportunity to write our first C++ test. |
21c3543 to
1ce1e17
Compare
|
Nah, gtest didn't work out. It was simpler to just write an test addon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, is it viable to use a technique similar to https://groups.google.com/d/msg/v8-users/JmhzmswiqvM/IC6UtV5FEC4J so that --expose-gc doesn't have to be passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk, seems to be a legit use of RequestGC here
|
LGTM. Does CI run these tests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I suggest you make this a counter and check that it's > 0 in FreeCallback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
|
LGTM |
FreeCallback should be invoked on the storage disposal (`ArrayBuffer`), not when the view (`Uint8Array` or `Buffer`) is disposed. This causes bug and crashes in addons which create buffers and store only slices of them. PR-URL: nodejs#3198 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1ce1e17 to
9d4063e
Compare
|
All fixed and rebased. Running CI. |
|
Landed in d1f2404, please backport to v4.x |
FreeCallback should be invoked on the storage disposal (`ArrayBuffer`), not when the view (`Uint8Array` or `Buffer`) is disposed. This causes bug and crashes in addons which create buffers and store only slices of them. PR-URL: #3198 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
FreeCallback should be invoked on the storage disposal (`ArrayBuffer`), not when the view (`Uint8Array` or `Buffer`) is disposed. This causes bug and crashes in addons which create buffers and store only slices of them. PR-URL: #3198 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
|
landed in v4.x-staging in 660f759 |
FreeCallback should be invoked on the storage disposal (
ArrayBuffer),not when the view (
Uint8ArrayorBuffer) is disposed. This causesbug and crashes in addons which create buffers and store only slices of
them.
cc @trevnorris @bnoordhuis @nodejs/collaborators