chore: fix memory leak in v8.serialize()#37021
Merged
Conversation
ckerr
approved these changes
Jan 25, 2023
Member
ckerr
left a comment
There was a problem hiding this comment.
The ArrayBuffer::New(..., NewBackingStore()) -> Node Buffer::New() sequence here makes sense to me and is consistent with the change that got merged upstream in 42695.
@codebytere thanks for linking to Anna's informative writeup of why this sequence is preferable and how it avoids the GC issue. 👍
nornagon
approved these changes
Jan 25, 2023
deepak1556
approved these changes
Jan 26, 2023
zcbenz
approved these changes
Jan 26, 2023
|
Release Notes Persisted
|
Contributor
|
I was unable to backport this PR to "22-x-y" cleanly; |
Contributor
|
I have automatically backported this PR to "23-x-y", please check out #37030 |
khalwa
pushed a commit
to solarwindscloud/electron
that referenced
this pull request
Feb 22, 2023
chore: fix memory leak in v8.serialize()
gecko19
pushed a commit
to brightsign/electron
that referenced
this pull request
Feb 28, 2023
chore: fix memory leak in v8.serialize()
Contributor
|
@yehengxuan has manually backported this PR to "22-x-y", please check out #37774 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Refs nodejs/node@74a5956
Fixes a memory leak in
v8.serialize()resultant of gc not being able to run properly. I implemented a modified version of this approach to be compatible with sandboxed pointers.Result of
parallel/test-v8-serialize-leak:Before this change:
before=85573632 after=4512022528- 52.7x increased memory usageAfter this change
before=85524480 after=189775872- 2.2x increased memory usageChecklist
npm testpassesRelease Notes
Notes: Fixed a memory leak in
v8.serialize()when running Node.js within Electron.