interface
jsc.HeapStats
interface HeapStats
Statistics about the JavaScript heap, returned by heapStats. Sizes are in bytes.
heapSize and objectCount only count the objects that survived the most recent garbage collection, while objectTypeCounts includes everything currently allocated, so call fullGC before taking a snapshot you intend to compare.
- extraMemorySize: number
Memory owned by objects in the heap but allocated outside of it, such as the contents of strings and
ArrayBuffers. Included in bothheapSizeandheapCapacity. - globalObjectCount: number
Number of global objects in the heap: one for the main script, plus one for each
node:vmcontext. - heapCapacity: number
Memory the heap has reserved for holding objects, plus
extraMemorySize. At leastheapSize; the difference is space that new objects can be allocated into without growing the heap. - heapSize: number
Size of the objects that survived the most recent garbage collection, plus
extraMemorySize. The same number heapSize returns. - objectCount: number
Number of cells that survived the most recent garbage collection. Every garbage-collected allocation is a cell: objects, strings, functions, and JavaScriptCore's internal structures alike.
- objectTypeCounts: Record<string, number>
Number of live cells of each type, keyed by JavaScriptCore's name for the type: JavaScript classes such as
Object,Array,Promise, andFunction, engine-internal types such asStructureandFunctionExecutable, andstringfor primitive strings. Ordered from most to least common; types with no live instances are omitted.Unlike
objectCount, this includes cells allocated since the last garbage collection. - protectedObjectCount: number
Number of cells that native code has protected from being garbage collected. getProtectedObjects returns them.
- protectedObjectTypeCounts: Record<string, number>
Like
objectTypeCounts, but counting only the cells included inprotectedObjectCount.