MemoryUsage
from panda3d.core import MemoryUsage
- class MemoryUsage
Bases:
DTOOL_SUPER_BASE
This class is used strictly for debugging purposes, specifically for tracking memory leaks of reference-counted objects: it keeps a record of every such object currently allocated.
When compiled with NDEBUG set, this entire class does nothing and compiles to a stub.
Inheritance diagram
- __init__(*args, **kwargs)
- counting = False
- current_cpp_size = 0
- external_size = 0
- freeze()
C++ Interface: freeze()
- /**
‘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()
C++ Interface: get_current_cpp_size()
- /**
Returns the total number of bytes of allocated memory consumed by C++
objects, not including the memory previously frozen.
*/
- getExternalSize()
C++ Interface: get_external_size()
- /**
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()
C++ Interface: get_num_pointers()
- /**
Returns the number of pointers currently active.
*/
- getPandaHeapArraySize()
C++ Interface: get_panda_heap_array_size()
- /**
Returns the total number of bytes allocated from the heap from code within
Panda, for arrays.
*/
- getPandaHeapOverhead()
C++ Interface: get_panda_heap_overhead()
- /**
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()
C++ Interface: get_panda_heap_single_size()
- /**
Returns the total number of bytes allocated from the heap from code within
Panda, for individual objects.
*/
- getPandaMmapSize()
C++ Interface: get_panda_mmap_size()
- /**
Returns the total number of bytes allocated from the virtual memory pool
from code within Panda.
*/
- getPointers()
C++ Interface: get_pointers(MemoryUsagePointers result)
- /**
Fills the indicated MemoryUsagePointers with the set of all pointers
currently active.
*/
- getPointersOfAge()
C++ Interface: get_pointers_of_age(MemoryUsagePointers result, double from, double to)
- /**
Fills the indicated MemoryUsagePointers with the set of all pointers that
were allocated within the range of the indicated number of seconds ago.
*/
- getPointersOfType()
C++ Interface: get_pointers_of_type(MemoryUsagePointers result, TypeHandle type)
- /**
Fills the indicated MemoryUsagePointers with the set of all pointers of the
indicated type currently active.
*/
- getPointersWithZeroCount()
C++ Interface: get_pointers_with_zero_count(MemoryUsagePointers result)
- /**
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()
C++ Interface: get_total_cpp_size()
- /**
Returns the total number of bytes of allocated memory consumed by C++
objects, including the memory previously frozen.
*/
- getTotalSize()
C++ Interface: get_total_size()
- /**
Returns the total size of allocated memory consumed by the process, as
nearly as can be determined.
*/
- get_current_cpp_size()
C++ Interface: get_current_cpp_size()
- /**
Returns the total number of bytes of allocated memory consumed by C++
objects, not including the memory previously frozen.
*/
- get_external_size()
C++ Interface: get_external_size()
- /**
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.
*/
- get_num_pointers()
C++ Interface: get_num_pointers()
- /**
Returns the number of pointers currently active.
*/
- get_panda_heap_array_size()
C++ Interface: get_panda_heap_array_size()
- /**
Returns the total number of bytes allocated from the heap from code within
Panda, for arrays.
*/
- get_panda_heap_overhead()
C++ Interface: get_panda_heap_overhead()
- /**
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.
*/
- get_panda_heap_single_size()
C++ Interface: get_panda_heap_single_size()
- /**
Returns the total number of bytes allocated from the heap from code within
Panda, for individual objects.
*/
- get_panda_mmap_size()
C++ Interface: get_panda_mmap_size()
- /**
Returns the total number of bytes allocated from the virtual memory pool
from code within Panda.
*/
- get_pointers()
C++ Interface: get_pointers(MemoryUsagePointers result)
- /**
Fills the indicated MemoryUsagePointers with the set of all pointers
currently active.
*/
- get_pointers_of_age()
C++ Interface: get_pointers_of_age(MemoryUsagePointers result, double from, double to)
- /**
Fills the indicated MemoryUsagePointers with the set of all pointers that
were allocated within the range of the indicated number of seconds ago.
*/
- get_pointers_of_type()
C++ Interface: get_pointers_of_type(MemoryUsagePointers result, TypeHandle type)
- /**
Fills the indicated MemoryUsagePointers with the set of all pointers of the
indicated type currently active.
*/
- get_pointers_with_zero_count()
C++ Interface: get_pointers_with_zero_count(MemoryUsagePointers result)
- /**
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.
*/
- get_total_cpp_size()
C++ Interface: get_total_cpp_size()
- /**
Returns the total number of bytes of allocated memory consumed by C++
objects, including the memory previously frozen.
*/
- get_total_size()
C++ Interface: get_total_size()
- /**
Returns the total size of allocated memory consumed by the process, as
nearly as can be determined.
*/
- isCounting()
C++ Interface: is_counting()
- /**
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()
C++ Interface: is_tracking()
- /**
Returns true if the MemoryUsage object is currently tracking memory (e.g.
track-memory-usage is configured #t).
*/
- is_counting()
C++ Interface: is_counting()
- /**
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.
*/
- is_tracking()
C++ Interface: is_tracking()
- /**
Returns true if the MemoryUsage object is currently tracking memory (e.g.
track-memory-usage is configured #t).
*/
- panda_heap_array_size = 14992
- panda_heap_overhead = 18720
- panda_heap_single_size = 203856
- panda_mmap_size = 0
- showCurrentAges()
C++ Interface: show_current_ages()
- /**
Shows the breakdown of ages of all of the active pointers.
*/
- showCurrentTypes()
C++ Interface: show_current_types()
- /**
Shows the breakdown of types of all of the active pointers.
*/
- showTrendAges()
C++ Interface: show_trend_ages()
- /**
Shows the breakdown of ages of all of the pointers allocated and freed
since the last call to freeze().
*/
- showTrendTypes()
C++ Interface: show_trend_types()
- /**
Shows the breakdown of types of all of the pointers allocated and freed
since the last call to freeze().
*/
- show_current_ages()
C++ Interface: show_current_ages()
- /**
Shows the breakdown of ages of all of the active pointers.
*/
- show_current_types()
C++ Interface: show_current_types()
- /**
Shows the breakdown of types of all of the active pointers.
*/
- show_trend_ages()
C++ Interface: show_trend_ages()
- /**
Shows the breakdown of ages of all of the pointers allocated and freed
since the last call to freeze().
*/
- show_trend_types()
C++ Interface: show_trend_types()
- /**
Shows the breakdown of types of all of the pointers allocated and freed
since the last call to freeze().
*/
- total_cpp_size = 0
- total_size = 237568
- tracking = False