-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
[v24.x backport] v8: adding total_allocated_bytes to HeapStatistics #60801
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
base: v24.x-staging
Are you sure you want to change the base?
Conversation
Original commit message:
[api] Adding total allocated bytes in HeapStatistics
This change exposes total allocated bytes in v8::HeapStatistics API by
introducing a new total_allocated_bytes() method that tracks all heap
allocations since an Isolate creation.
The implementation adds:
- uint64_t total_allocated_bytes_ field to HeapStatistics.
- An atomic total allocation counter is stored in the Heap class.
- The counter is incremented whenever a RestLab is called. This approach can overestimate the total allocation for cases where the LAB is not fully used, but the leftover compared to the LAB itself is quite small, so it seems tolerable.
Design doc reference:
https://docs.google.com/document/d/1O4JPsoaxTQsX_7T5Fz4rsGeHMiM16jUrvDuq9FrtbNM
Change-Id: Ic531698aaeb1578f943b7fdd346b9159ffd9b6c9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6996467
Reviewed-by: Dominik Inführ <[email protected]>
Reviewed-by: Michael Lippautz <[email protected]>
Commit-Queue: Dmitry Bezhetskov <[email protected]>
Cr-Commit-Position: refs/heads/main@{#103296}
Refs: v8/v8@fe81545
Co-authored-by: Caio Lima <[email protected]>
PR-URL: nodejs#60429
Reviewed-By: Joyee Cheung <[email protected]>
PR-URL: nodejs#60573 Reviewed-By: theanarkh <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> fixing tab error.
|
Review requested:
|
I'm no expert on ABI's, but doesn't that change just shift the breakage to |
I'm not an expert either, so my understanding might be faulty. IIUC, the addition of new non-virtual methods doesn't break ABI, while changing the layout of HeapStatistics do. Any program that compiles with previous |
|
I'm also considering here that the addition of |
This PR contains backport of #60573 to v24. Since it depends on #60429, it also includes a backport version of this PR as well.
To avoid ABI changes, we are also taking in consideration the changes proposed on #60800 from original V8 PR where
Isolate:: GetTotalAllocatedBytesis introduced as an alternative method to gettotal_allocated_bytes_. This avoids ABI breakage due to changes made onHeapStatistics.