From 2bb04dde97913496dd0fa8eaaa9449165c86d9b2 Mon Sep 17 00:00:00 2001 From: Benji Marinacci Date: Mon, 26 Aug 2024 22:11:13 -0700 Subject: [PATCH 1/2] doc: add getHeapStatistics() property descriptions --- doc/api/v8.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/api/v8.md b/doc/api/v8.md index 23c4ee7de9116d..60cc72e063c38e 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -198,6 +198,35 @@ Returns an object with the following properties: * `used_global_handles_size` {number} * `external_memory` {number} +`total_heap_size` The value of total\_heap\_size is the number of bytes V8 has +allocated for the heap. This can grow if used\_heap needs more memory. + +`total_heap_size_executable` The value of total\_heap\_size\_executable is the +portion of the heap that can contain executable code, in bytes. This includes +memory used by JIT-compiled code and any memory that must be kept executable. + +`total_physical_size` The value of total\_physical\_size actual physical memory +used by the V8 heap, in bytes. This is the amount of memory that is committed +(or in use) rather than reserved. + +`total_available_size` The value of total\_available\_size is the number of +bytes of memory available to the V8 heap. This value represents how much +more memory V8 can use before it exceeds the heap limit. + +`used_heap_size` The value of used\_heap\_size is number of bytes currently +being used by V8’s JavaScript objects. This is the actual memory in use and +does not include memory that has been allocated but not yet used. + +`heap_size_limit` The value of heap\_size\_limit is the maximum size of the V8 +heap, in bytes (either the default limit, determined by system resources, or +the value passed to the `--max_old_space_size` option). + +`malloced_memory` The value of malloced\_memory is the number of bytes allocated +through `malloc` by V8. + +`peak_malloced_memory` The value of peak\_malloced\_memory is the peak number of +bytes allocated through `malloc` by V8 during the lifetime of the process. + `does_zap_garbage` is a 0/1 boolean, which signifies whether the `--zap_code_space` option is enabled or not. This makes V8 overwrite heap garbage with a bit pattern. The RSS footprint (resident set size) gets bigger From ffa717305ef7df03b8ff686ddeb8677d1afb1cfc Mon Sep 17 00:00:00 2001 From: Benji Marinacci Date: Mon, 26 Aug 2024 23:08:11 -0700 Subject: [PATCH 2/2] Update doc/api/v8.md Co-authored-by: Luigi Pinca --- doc/api/v8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/v8.md b/doc/api/v8.md index 60cc72e063c38e..e57b56aa5ca0d7 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -205,7 +205,7 @@ allocated for the heap. This can grow if used\_heap needs more memory. portion of the heap that can contain executable code, in bytes. This includes memory used by JIT-compiled code and any memory that must be kept executable. -`total_physical_size` The value of total\_physical\_size actual physical memory +`total_physical_size` The value of total\_physical\_size is the actual physical memory used by the V8 heap, in bytes. This is the amount of memory that is committed (or in use) rather than reserved.