Skip to content

Commit

Permalink
fixup! src,doc: add C++ internals documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Nov 20, 2019
1 parent 130ef12 commit 2445c17
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,15 @@ When calling into JavaScript without using [`MakeCallback()`][], check the
### `MemoryRetainer`

A large number of classes in the Node.js C++ codebase refer to other objects.
Inheriting from the `MemoryRetainer` class enables objects in a heap snapshot
to refer to instances of that class, and in turn enables that class to point
to other objects as well, including native C++ types such as `std::string`
and track their memory usage.
The `MemoryRetainer` class is a helper for annotating C++ classes with
information that can be used by the heap snapshot builder in V8, so that
memory retained by C++ can be tracked in V8 heap snapshots captured in
Node.js applications.

Inheriting from the `MemoryRetainer` class enables objects (both from JavaScript
and C++) to refer to instances of that class, and in turn enables that class
to point to other objects as well, including native C++ types
such as `std::string` and track their memory usage.

This can be useful for debugging memory leaks.

Expand Down

0 comments on commit 2445c17

Please sign in to comment.