-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
smalloc: do not track external memory #1375
Conversation
The memory that was allocated outside of the `smalloc.cc` should not be tracked using `AdjustAmountOfExternalAllocatedMemory`. There are no potential issues except triggering V8's GC way too often. In fact, `heap.js` is creating a buffer out of the pointer, and since it doesn't know the size of the pointer - it just creates the maximum possible `Buffer` instance with a no-op free callback and no hint.
882c657
to
1407d99
Compare
callback_(static_cast<char*>(array_data), hint_); | ||
isolate->AdjustAmountOfExternalAllocatedMemory( | ||
-static_cast<int64_t>(sizeof(*this))); |
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.
It's arguably better to call Isolate::AdjustAmountOfExternalAllocatedMemory() only once. As is, the code may potentially trigger a GC twice.
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.
Fixed.
LGTM if the CI is happy. |
Thank you! |
win2008r2 is just timers defying.. time. Again. |
I guess we are good to go? |
The memory that was allocated outside of the `smalloc.cc` should not be tracked using `AdjustAmountOfExternalAllocatedMemory`. There are no potential issues except triggering V8's GC way too often. In fact, `heap.js` is creating a buffer out of the pointer, and since it doesn't know the size of the pointer - it just creates the maximum possible `Buffer` instance with a no-op free callback and no hint. PR-URL: #1375 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Landed in ff74931, thank you! |
The memory that was allocated outside of the
smalloc.cc
should not betracked using
AdjustAmountOfExternalAllocatedMemory
. There are nopotential issues except triggering V8's GC way too often.
In fact,
heap.js
is creating a buffer out of the pointer, and since itdoesn't know the size of the pointer - it just creates the maximum
possible
Buffer
instance with a no-op free callback and no hint.R=@trevnorris or @bnoordhuis