Interface for providing information about embedder's objects held by global handles. This information is reported in two ways:
- When calling AddObjectGroup, an embedder may pass RetainedObjectInfo instance describing the group. To collect this information while taking a heap snapshot, V8 calls GC prologue and epilogue callbacks.
- When a heap snapshot is collected, V8 additionally requests RetainedObjectInfos for persistent handles that were not previously reported via AddObjectGroup.
Thus, if an embedder wants to provide information about native objects for heap snapshots, it can do it in a GC prologue handler, and / or by assigning wrapper class ids in the following way:
- Bind a callback to class id by calling SetWrapperClassInfoProvider.
- Call SetWrapperClassId on certain persistent handles.
V8 takes ownership of RetainedObjectInfo instances passed to it and keeps them alive only during snapshot collection. Afterwards, they are freed by calling the Dispose class function.