|
Go to the source code of this file.
Classes | |
class | TfMallocTag |
Top-down memory tagging system. More... | |
struct | TfMallocTag::CallTree |
Summary data structure for malloc statistics. More... | |
struct | TfMallocTag::CallTree::PathNode |
Node in the call tree structure. More... | |
struct | TfMallocTag::CallTree::CallSite |
Record of the bytes allocated under each different tag. More... | |
struct | TfMallocTag::CallStackInfo |
This struct is used to represent a call stack taken for an allocation that was billed under a specific malloc tag. More... | |
class | TfMallocTag::Auto |
Scoped (i.e. More... | |
Macros | |
#define | TF_MALLOC_TAG_NEW(name1, name2) |
Enable lib/tf memory management. | |
Typedefs | |
using | TfAutoMallocTag = TfMallocTag::Auto |
Top-down memory tagging system. | |
using | TfAutoMallocTag2 = TfMallocTag::Auto |
Top-down memory tagging system. | |
struct TfMallocTag::CallTree::PathNode |
Node in the call tree structure.
A PathNode
captures the hierarchy of active TfAutoMallocTag
objects that are pushed and popped during program execution. Each PathNode
thus describes a sequence of call-sites (i.e. a path down the call tree). Repeated call sites (in the case of co-recursive function calls) can be skipped, e.g. pushing tags "A", "B", "C", "B", "C" leads to only three path-nodes, representing the paths "A", "AB", and "ABC". Allocations done at the bottom (i.e. when tags "A", "B", "C", "B", "C" are all active) are billed to the longest path node in the sequence, which corresponds to the path "ABC").
Path nodes track both the memory they incur directly (nBytesDirect
) but more importantly, the total memory allocated by themselves and any of their children (nBytes
). The name of a node (siteName
) corresponds to the tag name of the final tag in the path.
Definition at line 63 of file mallocTag.h.
Class Members | ||
---|---|---|
vector< PathNode > | children | Children nodes. |
size_t | nAllocations | The number of allocations for this node. |
size_t | nBytes | Allocated bytes by this or descendant nodes. |
size_t | nBytesDirect | Allocated bytes (only for this node). |
string | siteName | Tag name. |
struct TfMallocTag::CallTree::CallSite |
Record of the bytes allocated under each different tag.
Each construction of a TfAutoMallocTag
object with a different argument produces a distinct CallSite
record. The total bytes outstanding for all memory allocations made under a given call-site are recorded in nBytes
, while the name of the call site is available as name
.
Definition at line 80 of file mallocTag.h.
Class Members | ||
---|---|---|
string | name | Tag name. |
size_t | nBytes | Allocated bytes. |
struct TfMallocTag::CallStackInfo |
This struct is used to represent a call stack taken for an allocation that was billed under a specific malloc tag.
Definition at line 157 of file mallocTag.h.
#define TF_MALLOC_TAG_NEW | ( | name1, | |
name2 | |||
) |
Enable lib/tf memory management.
Invoking this macro inside a class body causes the class operator new
to push two TfAutoMallocTag
objects onto the stack before actually allocating memory for the class. The names passed into the tag are used for the two tags; pass NULL if you don't need the second tag. For example,
will cause dynamic allocations of MyBigMeshVertex
to be grouped under the tag Vertex
which is in turn grouped under MyBigMesh
. However,
specifies NULL
for the second tag because the first tag is sufficient.
Normally, this macro should be placed in the public section of a class. Note that you cannot specify both this and TF_FIXED_SIZE_ALLOCATOR()
for the same class.
Also, note that allocations of a class inside an STL datastructure will not be grouped under the indicated tags.
Definition at line 475 of file mallocTag.h.
using TfAutoMallocTag = TfMallocTag::Auto |
Top-down memory tagging system.
Definition at line 434 of file mallocTag.h.
using TfAutoMallocTag2 = TfMallocTag::Auto |
Top-down memory tagging system.
Definition at line 437 of file mallocTag.h.