diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-24 13:26:11 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-24 13:26:11 +0300 |
commit | 236ca8fbe84575504f6ae80aec63c8059b875ef0 (patch) | |
tree | 5a889765ba6363b99b1d27231594592013f3263f /source/blender/makesrna/intern/makesrna.c | |
parent | 38863924305367eaae65d9447f8a306b86d6ea44 (diff) |
Allocator: make leak detection work with static variables
When definining static variables that own memory, you should
use the "construct on first use" idiom. Otherwise, you'll get
a warning when Blender exits.
More details are provided in D8354.
Differential Revision: https://developer.blender.org/D8354
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index b34c324bd91..045d098bf6a 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -5144,7 +5144,10 @@ static void mem_error_cb(const char *errorStr) int main(int argc, char **argv) { - int totblock, return_status = 0; + int return_status = 0; + + MEM_initialize_memleak_detection(); + MEM_set_error_callback(mem_error_cb); CLG_init(); @@ -5166,12 +5169,5 @@ int main(int argc, char **argv) CLG_exit(); - totblock = MEM_get_memory_blocks_in_use(); - if (totblock != 0) { - fprintf(stderr, "Error Totblock: %d\n", totblock); - MEM_set_error_callback(mem_error_cb); - MEM_printmemlist(); - } - return return_status; } |