Go to the documentation of this file.
21 #ifdef DO_MEMORY_USAGE
22 return get_global_ptr()->_track_memory_usage;
33 #ifdef DO_MEMORY_USAGE
34 get_global_ptr()->ns_record_pointer(ptr);
43 #ifdef DO_MEMORY_USAGE
44 get_global_ptr()->ns_record_pointer(ptr, type);
56 #ifdef DO_MEMORY_USAGE
57 get_global_ptr()->ns_update_type((
void *)ptr, type);
69 #ifdef DO_MEMORY_USAGE
70 get_global_ptr()->ns_update_type((
void *)ptr, typed_ptr);
81 #ifdef DO_MEMORY_USAGE
82 get_global_ptr()->ns_update_type(ptr, type);
91 #ifdef DO_MEMORY_USAGE
92 get_global_ptr()->ns_remove_pointer(ptr);
102 #ifdef DO_MEMORY_USAGE
103 return get_global_ptr()->_track_memory_usage;
116 #ifdef DO_MEMORY_USAGE
117 return get_global_ptr()->_count_memory_usage;
129 #ifdef DO_MEMORY_USAGE
130 return get_global_ptr()->_current_cpp_size;
142 #ifdef DO_MEMORY_USAGE
143 return get_global_ptr()->_total_cpp_size;
155 #ifdef DO_MEMORY_USAGE
168 #ifdef DO_MEMORY_USAGE
182 #if defined(DO_MEMORY_USAGE) && (defined(USE_MEMORY_DLMALLOC) || defined(USE_MEMORY_PTMALLOC2))
196 #ifdef DO_MEMORY_USAGE
217 #ifdef DO_MEMORY_USAGE
219 if (mu->_count_memory_usage) {
223 #if defined(USE_MEMORY_DLMALLOC) || defined(USE_MEMORY_PTMALLOC2)
226 return mu->_total_size;
230 return mu->_total_size - (size_t)mu->_total_heap_single_size - (
size_t)mu->_total_heap_array_size;
246 #ifdef DO_MEMORY_USAGE
248 if (mu->_count_memory_usage) {
249 return mu->_total_size + (size_t)mu->_requested_heap_size;
251 #if defined(USE_MEMORY_DLMALLOC) || defined(USE_MEMORY_PTMALLOC2)
252 return (
size_t)mu->_requested_heap_size;
267 #ifdef DO_MEMORY_USAGE
268 return get_global_ptr()->ns_get_num_pointers();
280 #ifdef DO_MEMORY_USAGE
281 get_global_ptr()->ns_get_pointers(result);
291 #ifdef DO_MEMORY_USAGE
292 get_global_ptr()->ns_get_pointers_of_type(result, type);
302 #ifdef DO_MEMORY_USAGE
303 get_global_ptr()->ns_get_pointers_of_age(result, from, to);
325 #ifdef DO_MEMORY_USAGE
326 get_global_ptr()->ns_get_pointers_with_zero_count(result);
338 #ifdef DO_MEMORY_USAGE
339 get_global_ptr()->ns_freeze();
348 #ifdef DO_MEMORY_USAGE
349 get_global_ptr()->ns_show_current_types();
359 #ifdef DO_MEMORY_USAGE
360 get_global_ptr()->ns_show_trend_types();
369 #ifdef DO_MEMORY_USAGE
370 get_global_ptr()->ns_show_current_ages();
380 #ifdef DO_MEMORY_USAGE
381 get_global_ptr()->ns_show_trend_ages();
390 #ifdef DO_MEMORY_USAGE
393 if (__builtin_expect(_global_ptr ==
nullptr, 0)) {
395 if (_global_ptr ==
nullptr) {
This is a list of pointers returned by a MemoryUsage object in response to some query.
static void show_current_ages()
Shows the breakdown of ages of all of the active pointers.
static Integer get(const Integer &var)
Atomically retrieves the snapshot value of the indicated variable.
static void get_pointers_of_type(MemoryUsagePointers &result, TypeHandle type)
Fills the indicated MemoryUsagePointers with the set of all pointers of the indicated type currently ...
A base class for all things that want to be reference-counted.
get_panda_heap_array_size
Returns the total number of bytes allocated from the heap from code within Panda, for arrays.
static void record_pointer(ReferenceCount *ptr)
Indicates that the given pointer has been recently allocated.
is_tracking
Returns true if the MemoryUsage object is currently tracking memory (e.g.
static void get_pointers_with_zero_count(MemoryUsagePointers &result)
Fills the indicated MemoryUsagePointers with the set of all currently active pointers (that is,...
get_external_size
Returns the total number of bytes of allocated memory in the heap that Panda didn't seem to be respon...
This class is used strictly for debugging purposes, specifically for tracking memory leaks of referen...
get_panda_heap_single_size
Returns the total number of bytes allocated from the heap from code within Panda, for individual obje...
static void get_pointers(MemoryUsagePointers &result)
Fills the indicated MemoryUsagePointers with the set of all pointers currently active.
get_panda_mmap_size
Returns the total number of bytes allocated from the virtual memory pool from code within Panda.
TypeHandle is the identifier used to differentiate C++ class types.
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
static void freeze()
'Freezes' all pointers currently stored so that they are no longer reported; only newly allocate poin...
static void show_current_types()
Shows the breakdown of types of all of the active pointers.
static void show_trend_types()
Shows the breakdown of types of all of the pointers allocated and freed since the last call to freeze...
get_total_cpp_size
Returns the total number of bytes of allocated memory consumed by C++ objects, including the memory p...
static bool get_track_memory_usage()
Returns true if the user has Configured the variable 'track-memory-usage' to true,...
get_total_size
Returns the total size of allocated memory consumed by the process, as nearly as can be determined.
get_panda_heap_overhead
Returns the extra bytes allocated from the system that are not immediately used for holding allocated...
static void show_trend_ages()
Shows the breakdown of ages of all of the pointers allocated and freed since the last call to freeze(...
static void remove_pointer(ReferenceCount *ptr)
Indicates that the given pointer has been recently freed.
static int get_num_pointers()
Returns the number of pointers currently active.
is_counting
Returns true if the MemoryUsage object is currently at least counting memory (e.g.
get_current_cpp_size
Returns the total number of bytes of allocated memory consumed by C++ objects, not including the memo...
static void 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 r...
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...