-
Notifications
You must be signed in to change notification settings - Fork 30k
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
process: report ArrayBuffer memory in memoryUsage()
#31550
Closed
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
20947c7
process: report ArrayBuffer memory in `memoryUsage()`
addaleax 5e624ba
fixup! process: report ArrayBuffer memory in `memoryUsage()`
addaleax ba44913
fixup! process: report ArrayBuffer memory in `memoryUsage()`
addaleax a6e74b3
fixup! fixup! process: report ArrayBuffer memory in `memoryUsage()`
addaleax 4267523
fixup! process: report ArrayBuffer memory in `memoryUsage()`
addaleax a3014ce
fixup! process: report ArrayBuffer memory in `memoryUsage()`
addaleax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
sorry for being
raw
here, but I have these questions:0
- why again - why this decision cannot be deterministic as opposed to probabilistic? which factors decide the outcome? how would one use those factors to decide whether the value is trustworthy or not?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.
Because embedders can specify their own
ArrayBuffer::Allocator
, which would not necessarily track allocations (e.g.Electron
does this).Inside the C++
MemoryUsage()
binding, there’s aarray_buffer_allocator == nullptr
check. If there is noNodeArrayBufferAllocator*
that the embedder informed us about, then the method sets the field for array buffers to 0.I don’t really understand this question, sorry – there is nothing probabilistic involved here, I think?
I think that’s also answered by the first question, but let me know if I’m misunderstanding.
I think it’s safe to say that the value is trustworthy when it’s not
0
.I didn’t want to go into a ton of detail in the documentation here – imo there should be an indication that the value may not always be provided, and that tools should not make the expectation that the value is non-zero. But for a tool it’s not really going to matter why exactly the value can’t be reported, I think, other than that it’s related to the fact that the Node.js code is running in a specific environment that behaves differently.
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.
I termed it as probabilistic because of
may be 0
phrase. But based on your explanation to the rest of the questions, I understand it as:if embedders use only non-node.js allocators without a tracker, then this value
WILL
be 0 (not truly reflecting actual consumption), and if embedders rely on node.js' allocators, then the value will be accurate - zero or non-zeroAre we on the same page?
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.
@gireeshpunathil Yes, we are 👍 I feel like the most important thing is that the doc makes clear that this does not affect standard Node.js binaries.
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.
Maybe a simple "because such allocations may not be tracked" would be good?
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.
@jasnell Sure, done 👍