MemoryUsage

Inheritance:

Methods of MemoryUsage:

freeze
static void MemoryUsage::freeze(void);

Description: 'Freezes' all pointers currently stored so that they are no longer reported; only newly allocate pointers from this point on will appear in future information requests. This makes it easier to differentiate between continuous leaks and one-time memory allocations.

getCurrentCppSize
static unsigned int MemoryUsage::get_current_cpp_size(void);

Description: Returns the total number of bytes of allocated memory consumed by C++ objects, not including the memory previously frozen.

getExternalSize
static unsigned int MemoryUsage::get_external_size(void);

Description: Returns the total number of bytes of allocated memory in the heap that Panda didn't seem to be responsible for. This includes a few bytes for very low-level objects (like ConfigVariables) that cannot use Panda memory tracking because they are so very low-level.
This also includes all of the memory that might have been allocated by a high-level interpreter, like Python.
This number is only available if Panda is able to hook into the actual heap callback.

getNumPointers
static int MemoryUsage::get_num_pointers(void);

Description: Returns the number of pointers currently active.

getPandaHeapArraySize
static unsigned int MemoryUsage::get_panda_heap_array_size(void);

Description: Returns the total number of bytes allocated from the heap from code within Panda, for arrays.

getPandaHeapOverhead
static unsigned int MemoryUsage::get_panda_heap_overhead(void);

Description: Returns the extra bytes allocated from the system that are not immediately used for holding allocated objects. This can only be determined if ALTERNATIVE_MALLOC is enabled.

getPandaHeapSingleSize
static unsigned int MemoryUsage::get_panda_heap_single_size(void);

Description: Returns the total number of bytes allocated from the heap from code within Panda, for individual objects.

getPandaMmapSize
static unsigned int MemoryUsage::get_panda_mmap_size(void);

Description: Returns the total number of bytes allocated from the virtual memory pool from code within Panda.

getPointers
static void MemoryUsage::get_pointers(MemoryUsagePointers &result);

Description: Fills the indicated MemoryUsagePointers with the set of all pointers currently active.

getPointersOfAge
static void MemoryUsage::get_pointers_of_age(MemoryUsagePointers &result, double from, double to);

Description: Fills the indicated MemoryUsagePointers with the set of all pointers that were allocated within the range of the indicated number of seconds ago.

getPointersOfType
static void MemoryUsage::get_pointers_of_type(MemoryUsagePointers &result, TypeHandle type);

Description: Fills the indicated MemoryUsagePointers with the set of all pointers of the indicated type currently active.

getPointersWithZeroCount
static void MemoryUsage::get_pointers_with_zero_count(MemoryUsagePointers &result);

Description: Fills the indicated MemoryUsagePointers with the set of all currently active pointers (that is, pointers allocated since the last call to freeze(), and not yet freed) that have a zero reference count.
Generally, an undeleted pointer with a zero reference count means its reference count has never been incremented beyond zero (since once it has been incremented, the only way it can return to zero would free the pointer). This may include objects that are allocated statically or on the stack, which are never intended to be deleted. Or, it might represent a programmer or compiler error.
This function has the side-effect of incrementing each of their reference counts by one, thus preventing them from ever being freed--but since they hadn't been freed anyway, probably no additional harm is done.

getTotalCppSize
static unsigned int MemoryUsage::get_total_cpp_size(void);

Description: Returns the total number of bytes of allocated memory consumed by C++ objects, including the memory previously frozen.

getTotalSize
static unsigned int MemoryUsage::get_total_size(void);

Description: Returns the total size of allocated memory consumed by the process, as nearly as can be determined.

isCounting
static bool MemoryUsage::is_counting(void);

Description: Returns true if the MemoryUsage object is currently at least counting memory (e.g. this is a Windows debug build), even if it's not fully tracking it.

isTracking
static bool MemoryUsage::is_tracking(void);

Description: Returns true if the MemoryUsage object is currently tracking memory (e.g. track-memory-usage is configured #t).

showCurrentAges
static void MemoryUsage::show_current_ages(void);

Description: Shows the breakdown of ages of all of the active pointers.

showCurrentTypes
static void MemoryUsage::show_current_types(void);

Description: Shows the breakdown of types of all of the active pointers.

showTrendAges
static void MemoryUsage::show_trend_ages(void);

Description: Shows the breakdown of ages of all of the pointers allocated and freed since the last call to freeze().

showTrendTypes
static void MemoryUsage::show_trend_types(void);

Description: Shows the breakdown of types of all of the pointers allocated and freed since the last call to freeze().