wavelength 1.0.0
Loading...
Searching...
No Matches
AllocInfo Class Reference

Record of one tracked allocation: its sizes, its tags, and the call stack that made it. More...

#include <allocinfo.h>

Public Member Functions

void CaptureStack ()
 Record the return addresses of the caller's caller and the callers above it.
void Print (PrnStream &stream) const
 Write the tag, the size, and the call stack of the record.
int GetSizeRequested () const
void SetSizeRequested (int nSizeRequested)
int GetSizeActual () const
void SetSizeActual (int nSizeActual)
const char * GetTag () const
void SetTag (const char *pszTag)
const char * GetPoolTag () const
void SetPoolTag (const char *pszPoolTag)
int GetPoolSize () const
void SetPoolSize (int nPoolSize)
void Print (PrnStream &stream) const
 Print the pool name and node size, or else the name and requested size.
bool operator< (const AllocInfo &other) const
 Order by requested size, pool node size, name, and pool name.

Static Public Member Functions

static bool Less (const AllocInfo *pFirst, const AllocInfo *pSecond)
 Order records by size, pool size, call stack, tag, and pool tag.

Public Attributes

int mSizeReq
const char * mName
const char * mPoolName

Static Public Attributes

static constexpr int kStackSize = 24
 The return addresses a record stores.

Detailed Description

Record of one tracked allocation: its sizes, its tags, and the call stack that made it.

What the memory tracker knows about one allocation.

The class is not polymorphic. The name is inferred. The records come from a BlockPool of 116-byte blocks, and a HeapTracker indexes them by the address of the allocation.

The object is 0x14 bytes and comes from a pool. A heap allocation that a pool carves into nodes records the pool's name as well. The name is inferred from the memory tracker's assertions.

Member Function Documentation

◆ CaptureStack()

void AllocInfo::CaptureStack ( )

Record the return addresses of the caller's caller and the callers above it.

Ghidra address:
NTSC-U/C: 0x0029beb8
Ghidra address:
PAL: 0x002a5ad8

◆ Print() [1/2]

void AllocInfo::Print ( PrnStream & stream) const

Write the tag, the size, and the call stack of the record.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x0029be00
Ghidra address:
PAL: 0x002a5a20

◆ Less()

bool AllocInfo::Less ( const AllocInfo * pFirst,
const AllocInfo * pSecond )
static

Order records by size, pool size, call stack, tag, and pool tag.

The tags compare as greater only when strcmp() reports exactly 1.

Parameters
pFirstThe first record.
pSecondThe second record.
Returns
Whether pFirst orders before pSecond.
Ghidra address:
NTSC-U/C: 0x0029bf28
Ghidra address:
PAL: 0x002a5b48

◆ GetSizeRequested()

int AllocInfo::GetSizeRequested ( ) const
inline
Returns
The bytes the caller requested, 0 for a pool block.

◆ SetSizeRequested()

void AllocInfo::SetSizeRequested ( int nSizeRequested)
inline
Parameters
nSizeRequestedThe bytes the caller requested, 0 for a pool block.

◆ GetSizeActual()

int AllocInfo::GetSizeActual ( ) const
inline
Returns
The bytes the heap handed out.

◆ SetSizeActual()

void AllocInfo::SetSizeActual ( int nSizeActual)
inline
Parameters
nSizeActualThe bytes the heap handed out.

◆ GetTag()

const char * AllocInfo::GetTag ( ) const
inline
Returns
The allocation tag, or null for a pool block.

◆ SetTag()

void AllocInfo::SetTag ( const char * pszTag)
inline
Parameters
pszTagThe allocation tag, or null for a pool block.

◆ GetPoolTag()

const char * AllocInfo::GetPoolTag ( ) const
inline
Returns
The tag of the pool block at the address, or null.

◆ SetPoolTag()

void AllocInfo::SetPoolTag ( const char * pszPoolTag)
inline
Parameters
pszPoolTagThe tag of the pool block at the address, or null.

◆ GetPoolSize()

int AllocInfo::GetPoolSize ( ) const
inline
Returns
The size of the pool block at the address.

◆ SetPoolSize()

void AllocInfo::SetPoolSize ( int nPoolSize)
inline
Parameters
nPoolSizeThe size of the pool block at the address.

◆ Print() [2/2]

void AllocInfo::Print ( PrnStream & stream) const

Print the pool name and node size, or else the name and requested size.

Parameters
streamThe destination.
Ghidra address:
0x10018360

◆ operator<()

bool AllocInfo::operator< ( const AllocInfo & other) const

Order by requested size, pool node size, name, and pool name.

Parameters
otherThe other record.
Returns
Whether this record sorts first.
Ghidra address:
0x100183d0

Member Data Documentation

◆ kStackSize

int AllocInfo::kStackSize = 24
staticconstexpr

The return addresses a record stores.

The last one is always cleared.

◆ mSizeReq

int AllocInfo::mSizeReq

Bytes requested from the heap.

◆ mName

const char* AllocInfo::mName

Name of the heap allocation, or null for a pool node alone.

◆ mPoolName

const char* AllocInfo::mPoolName

Name of the pool node, or null.


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