v8  10.1.124 (node 18.2.0)
V8 is Google's open source JavaScript engine
HeapSnapshot Class Reference

#include <v8-profiler.h>

Public Types

enum  SerializationFormat { kJSON = 0 }
 

Public Member Functions

const HeapGraphNodeGetRoot () const
 
const HeapGraphNodeGetNodeById (SnapshotObjectId id) const
 
int GetNodesCount () const
 
const HeapGraphNodeGetNode (int index) const
 
SnapshotObjectId GetMaxSnapshotJSObjectId () const
 
void Delete ()
 
void Serialize (OutputStream *stream, SerializationFormat format=kJSON) const
 

Detailed Description

HeapSnapshots record the state of the JS heap at some moment.

Definition at line 544 of file v8-profiler.h.

Member Enumeration Documentation

◆ SerializationFormat

Enumerator
kJSON 

Definition at line 546 of file v8-profiler.h.

Member Function Documentation

◆ Delete()

void Delete ( )

Deletes the snapshot and removes it from HeapProfiler's list. All pointers to nodes, edges and paths previously returned become invalid.

◆ GetMaxSnapshotJSObjectId()

SnapshotObjectId GetMaxSnapshotJSObjectId ( ) const

Returns a max seen JS object Id.

◆ GetNode()

const HeapGraphNode* GetNode ( int  index) const

Returns a node by index.

◆ GetNodeById()

const HeapGraphNode* GetNodeById ( SnapshotObjectId  id) const

Returns a node by its id.

◆ GetNodesCount()

int GetNodesCount ( ) const

Returns total nodes count in the snapshot.

◆ GetRoot()

const HeapGraphNode* GetRoot ( ) const

Returns the root node of the heap graph.

◆ Serialize()

void Serialize ( OutputStream stream,
SerializationFormat  format = kJSON 
) const

Prepare a serialized representation of the snapshot. The result is written into the stream provided in chunks of specified size. The total length of the serialized snapshot is unknown in advance, it can be roughly equal to JS heap size (that means, it can be really big - tens of megabytes).

For the JSON format, heap contents are represented as an object with the following structure:

{ snapshot: { title: "...", uid: nnn, meta: { meta-info }, node_count: nnn, edge_count: nnn }, nodes: [nodes array], edges: [edges array], strings: [strings array] }

Nodes reference strings, other nodes, and edges by their indexes in corresponding arrays.


The documentation for this class was generated from the following file: