File tree Expand file tree Collapse file tree 6 files changed +13
-2
lines changed Expand file tree Collapse file tree 6 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ Returns an object with the following properties:
197197* ` total_global_handles_size ` {number}
198198* ` used_global_handles_size ` {number}
199199* ` external_memory ` {number}
200+ * ` total_allocated_bytes ` {number}
200201
201202` total_heap_size ` The value of total\_ heap\_ size is the number of bytes V8 has
202203allocated for the heap. This can grow if used\_ heap needs more memory.
@@ -250,6 +251,9 @@ used memory size of V8 global handles.
250251` external_memory ` The value of external\_ memory is the memory size of array
251252buffers and external strings.
252253
254+ ` total_allocated_bytes ` The value of total allocated bytes since the Isolate
255+ creation
256+
253257<!-- eslint-skip -->
254258
255259``` js
Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ const {
136136 kTotalGlobalHandlesSizeIndex,
137137 kUsedGlobalHandlesSizeIndex,
138138 kExternalMemoryIndex,
139+ kTotalAllocatedBytes,
139140
140141 // Properties for heap spaces statistics buffer extraction.
141142 kHeapSpaces,
@@ -246,6 +247,7 @@ function getHeapStatistics() {
246247 total_global_handles_size : buffer [ kTotalGlobalHandlesSizeIndex ] ,
247248 used_global_handles_size : buffer [ kUsedGlobalHandlesSizeIndex ] ,
248249 external_memory : buffer [ kExternalMemoryIndex ] ,
250+ total_allocated_bytes : buffer [ kTotalAllocatedBytes ] ,
249251 } ;
250252}
251253
Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ using v8::Value;
7373 V (10 , number_of_detached_contexts, kNumberOfDetachedContextsIndex ) \
7474 V (11 , total_global_handles_size, kTotalGlobalHandlesSizeIndex ) \
7575 V (12 , used_global_handles_size, kUsedGlobalHandlesSizeIndex ) \
76- V (13 , external_memory, kExternalMemoryIndex )
76+ V (13 , external_memory, kExternalMemoryIndex ) \
77+ V (14 , total_allocated_bytes, kTotalAllocatedBytes ) \
7778
7879#define V (a, b, c ) +1
7980static constexpr size_t kHeapStatisticsPropertiesCount =
Original file line number Diff line number Diff line change @@ -1263,6 +1263,7 @@ void Worker::GetHeapStatistics(const FunctionCallbackInfo<Value>& args) {
12631263 " total_global_handles_size" ,
12641264 " used_global_handles_size" ,
12651265 " external_memory" ,
1266+ " total_allocated_bytes" ,
12661267 };
12671268 tmpl = DictionaryTemplate::New (isolate, heap_stats_names);
12681269 env->set_heap_statistics_template (tmpl);
@@ -1283,7 +1284,8 @@ void Worker::GetHeapStatistics(const FunctionCallbackInfo<Value>& args) {
12831284 Number::New (isolate, heap_stats->number_of_detached_contexts ()),
12841285 Number::New (isolate, heap_stats->total_global_handles_size ()),
12851286 Number::New (isolate, heap_stats->used_global_handles_size ()),
1286- Number::New (isolate, heap_stats->external_memory ())};
1287+ Number::New (isolate, heap_stats->external_memory ()),
1288+ Number::New (isolate, heap_stats->total_allocated_bytes ())};
12871289
12881290 Local<Object> obj;
12891291 if (!NewDictionaryInstanceNullProto (
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const keys = [
1212 'number_of_detached_contexts' ,
1313 'number_of_native_contexts' ,
1414 'peak_malloced_memory' ,
15+ 'total_allocated_bytes' ,
1516 'total_available_size' ,
1617 'total_global_handles_size' ,
1718 'total_heap_size' ,
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ if (isMainThread) {
4040 `total_global_handles_size` ,
4141 `used_global_handles_size` ,
4242 `external_memory` ,
43+ `total_allocated_bytes`
4344 ] . sort ( ) ;
4445 assert . deepStrictEqual ( keys , Object . keys ( stats ) . sort ( ) ) ;
4546 for ( const key of keys ) {
You can’t perform that action at this time.
0 commit comments