v8.getCppHeapStatistics([detailLevel])


使用 V8 CollectStatistics() 函数检索有关内存消耗和利用率的 CppHeap 统计信息,该函数可能会因 V8 版本的不同而有所变化。

\Retrieves CppHeap statistics regarding memory consumption and utilization using the V8 CollectStatistics() function which may change from one V8 version to the next.

  • detailLevel <string> | <undefined> :默认值:'detailed'。指定返回统计信息的详细程度。可接受的值包括:

    \detailLevel <string> | <undefined>: Default: 'detailed'. Specifies the level of detail in the returned statistics. Accepted values are:

    • 'brief':简要统计信息仅包含整个堆的顶层分配和使用的内存统计信息。

      \'brief': Brief statistics contain only the top-level allocated and used memory statistics for the entire heap.

    • 'detailed':详细统计信息还包含每个空间和页面的细分,以及空闲列表统计信息和对象类型直方图。

      \'detailed': Detailed statistics also contain a break down per space and page, as well as freelist statistics and object type histograms.

它返回一个具有与 cppgc::HeapStatistics 对象类似结构的对象。有关对象属性的更多信息,请参阅 V8 文档

\It returns an object with a structure similar to the cppgc::HeapStatistics object. See the V8 documentation for more information about the properties of the object.

// Detailed
({
 committed_size_bytes: 131072,
 resident_size_bytes: 131072,
 used_size_bytes: 152,
 space_statistics: [
 {
 name: 'NormalPageSpace0',
 committed_size_bytes: 0,
 resident_size_bytes: 0,
 used_size_bytes: 0,
 page_stats: [{}],
 free_list_stats: {},
 },
 {
 name: 'NormalPageSpace1',
 committed_size_bytes: 131072,
 resident_size_bytes: 131072,
 used_size_bytes: 152,
 page_stats: [{}],
 free_list_stats: {},
 },
 {
 name: 'NormalPageSpace2',
 committed_size_bytes: 0,
 resident_size_bytes: 0,
 used_size_bytes: 0,
 page_stats: [{}],
 free_list_stats: {},
 },
 {
 name: 'NormalPageSpace3',
 committed_size_bytes: 0,
 resident_size_bytes: 0,
 used_size_bytes: 0,
 page_stats: [{}],
 free_list_stats: {},
 },
 {
 name: 'LargePageSpace',
 committed_size_bytes: 0,
 resident_size_bytes: 0,
 used_size_bytes: 0,
 page_stats: [{}],
 free_list_stats: {},
 },
 ],
 type_names: [],
 detail_level: 'detailed',
}); 
// Brief
({
 committed_size_bytes: 131072,
 resident_size_bytes: 131072,
 used_size_bytes: 128864,
 space_statistics: [],
 type_names: [],
 detail_level: 'brief',
}); 

AltStyle によって変換されたページ (->オリジナル) /