20 "Freeing memory after the leak detector has run. This can happen when using "
21 "static variables in C++ that are defined outside of functions. To fix this "
22 "error, use the 'construct on first use' idiom.";
26bool fail_on_memleak =
false;
34 if (leaked_blocks == 0) {
38 printf(
"Error: Not freed memory blocks: %u, total unfreed memory %f MB\n",
40 double(mem_in_use) / 1024 / 1024);
48 if (fail_on_memleak) {
67 std::any any_data = std::make_any<int>(0);
79 static MemLeakPrinter printer;
84 fail_on_memleak =
true;
89 static std::mutex mutex;
90 static std::vector<std::any> data_vec;
91 std::lock_guard
lock{mutex};
92 data_vec.push_back(std::move(data));
Read Blender memory allocation and freeing.
void MEM_enable_fail_on_memleak()
bool leak_detector_has_run
void MEM_init_memleak_detection()
char free_after_leak_detection_message[]
size_t(*) MEM_get_memory_in_use(void)
void(*) mem_clearmemlist(void)
void(*) MEM_printmemlist(void)
uint(*) MEM_get_memory_blocks_in_use(void)
void memory_usage_init(void)
void add_memleak_data(std::any data)