diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-24 13:40:20 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-24 13:40:20 +0300 |
commit | f495b583bee5d43755c19bea4704e40d0e0f8a54 (patch) | |
tree | 26c151f759cdc245ae1ca3111056583c732f8d25 /source/blender | |
parent | b53c46d760568f02cd8be45547a4ffacad3c7b47 (diff) | |
parent | ec17b45034fbc9278bb42ea574bdaf2b8a6857e3 (diff) |
Merge branch 'blender-v2.90-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_registry.cc | 16 | ||||
-rw-r--r-- | source/blender/makesdna/intern/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 7 |
5 files changed, 17 insertions, 20 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_registry.cc b/source/blender/depsgraph/intern/depsgraph_registry.cc index c9d03e47ded..623702ee3ae 100644 --- a/source/blender/depsgraph/intern/depsgraph_registry.cc +++ b/source/blender/depsgraph/intern/depsgraph_registry.cc @@ -30,29 +30,35 @@ namespace blender { namespace deg { -static RawMap<Main *, RawVectorSet<Depsgraph *>> g_graph_registry; +using GraphRegistry = Map<Main *, VectorSet<Depsgraph *>>; +static GraphRegistry &get_graph_registry() +{ + static GraphRegistry graph_registry; + return graph_registry; +} void register_graph(Depsgraph *depsgraph) { Main *bmain = depsgraph->bmain; - g_graph_registry.lookup_or_add_default(bmain).add_new(depsgraph); + get_graph_registry().lookup_or_add_default(bmain).add_new(depsgraph); } void unregister_graph(Depsgraph *depsgraph) { Main *bmain = depsgraph->bmain; - RawVectorSet<Depsgraph *> &graphs = g_graph_registry.lookup(bmain); + GraphRegistry &graph_registry = get_graph_registry(); + VectorSet<Depsgraph *> &graphs = graph_registry.lookup(bmain); graphs.remove(depsgraph); // If this was the last depsgraph associated with the main, remove the main entry as well. if (graphs.is_empty()) { - g_graph_registry.remove(bmain); + graph_registry.remove(bmain); } } Span<Depsgraph *> get_all_registered_graphs(Main *bmain) { - RawVectorSet<Depsgraph *> *graphs = g_graph_registry.lookup_ptr(bmain); + VectorSet<Depsgraph *> *graphs = get_graph_registry().lookup_ptr(bmain); if (graphs != nullptr) { return *graphs; } diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 0f2761e311e..737ea9a7e12 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -40,6 +40,7 @@ set(SRC ../../blenlib/intern/BLI_memarena.c ../../blenlib/intern/BLI_mempool.c ../../blenlib/intern/hash_mm2a.c # needed by 'BLI_ghash_utils.c', not used directly. + ../../../../intern/guardedalloc/intern/leak_detector.cc ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index a6ed705ec67..0b43a5a6653 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -175,6 +175,7 @@ set(SRC ${DEFSRC} ${APISRC} ../../../../intern/clog/clog.c + ../../../../intern/guardedalloc/intern/leak_detector.cc ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c 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; } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index aa3f11c2515..945d5fd42e4 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -656,13 +656,6 @@ void WM_exit_ex(bContext *C, const bool do_python) BKE_blender_atexit(); - if (MEM_get_memory_blocks_in_use() != 0) { - size_t mem_in_use = MEM_get_memory_in_use() + MEM_get_memory_in_use(); - printf("Error: Not freed memory blocks: %u, total unfreed memory %f MB\n", - MEM_get_memory_blocks_in_use(), - (double)mem_in_use / 1024 / 1024); - MEM_printmemlist(); - } wm_autosave_delete(); BKE_tempdir_session_purge(); |