Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ccf12df

Browse filesBrowse files
r-52rvagg
authored andcommitted
src: add total_available_size to v8 statistics
v8 introduced the new flag `total_available_size` in version 4.4 and upwards. This flag is now available on `v8.getHeapStatistics` with the name `total_available_size`. It contains the total available heap size of v8. Introduced with commit: v8/v8@0a1352a7 PR-URL: #2348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent cc46d3b commit ccf12df
Copy full SHA for ccf12df

File tree

Expand file treeCollapse file tree

4 files changed

+7
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+7
-2
lines changed
Open diff view settings
Collapse file

‎doc/api/v8.markdown‎

Copy file name to clipboardExpand all lines: doc/api/v8.markdown
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Returns an object with the following properties
1515
total_heap_size: 7326976,
1616
total_heap_size_executable: 4194304,
1717
total_physical_size: 7326976,
18+
total_available_size: 1152656,
1819
used_heap_size: 3476208,
1920
heap_size_limit: 1535115264
2021
}
Collapse file

‎lib/v8.js‎

Copy file name to clipboardExpand all lines: lib/v8.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const heapStatisticsBuffer =
2222
const kTotalHeapSizeIndex = v8binding.kTotalHeapSizeIndex;
2323
const kTotalHeapSizeExecutableIndex = v8binding.kTotalHeapSizeExecutableIndex;
2424
const kTotalPhysicalSizeIndex = v8binding.kTotalPhysicalSizeIndex;
25+
const kTotalAvailableSize = v8binding.kTotalAvailableSize;
2526
const kUsedHeapSizeIndex = v8binding.kUsedHeapSizeIndex;
2627
const kHeapSizeLimitIndex = v8binding.kHeapSizeLimitIndex;
2728

@@ -34,6 +35,7 @@ exports.getHeapStatistics = function() {
3435
'total_heap_size': buffer[kTotalHeapSizeIndex],
3536
'total_heap_size_executable': buffer[kTotalHeapSizeExecutableIndex],
3637
'total_physical_size': buffer[kTotalPhysicalSizeIndex],
38+
'total_available_size': buffer[kTotalAvailableSize],
3739
'used_heap_size': buffer[kUsedHeapSizeIndex],
3840
'heap_size_limit': buffer[kHeapSizeLimitIndex]
3941
};
Collapse file

‎src/node_v8.cc‎

Copy file name to clipboardExpand all lines: src/node_v8.cc
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ using v8::Value;
2626
V(0, total_heap_size, kTotalHeapSizeIndex) \
2727
V(1, total_heap_size_executable, kTotalHeapSizeExecutableIndex) \
2828
V(2, total_physical_size, kTotalPhysicalSizeIndex) \
29-
V(3, used_heap_size, kUsedHeapSizeIndex) \
30-
V(4, heap_size_limit, kHeapSizeLimitIndex)
29+
V(3, total_available_size, kTotalAvailableSize) \
30+
V(4, used_heap_size, kUsedHeapSizeIndex) \
31+
V(5, heap_size_limit, kHeapSizeLimitIndex)
3132

3233
#define V(a, b, c) +1
3334
static const size_t kHeapStatisticsPropertiesCount =
Collapse file

‎test/parallel/test-v8-stats.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-v8-stats.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var v8 = require('v8');
66
var s = v8.getHeapStatistics();
77
var keys = [
88
'heap_size_limit',
9+
'total_available_size',
910
'total_heap_size',
1011
'total_heap_size_executable',
1112
'total_physical_size',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.