From eff9bdfdaa63c97cde2ec0fa336e210fad2ef048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 24 May 2020 00:37:36 +0200 Subject: [PATCH] Fixes #148 again (Fix static initialization issues in pmr global resources) --- src/global_resource.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/global_resource.cpp b/src/global_resource.cpp index f92c923..a7f03f2 100644 --- a/src/global_resource.cpp +++ b/src/global_resource.cpp @@ -95,6 +95,10 @@ BOOST_CONTAINER_DECL memory_resource* get_default_resource() BOOST_NOEXCEPT //TO-DO: synchronizes-with part using atomics if(dlmalloc_global_sync_lock()){ memory_resource *current = default_memory_resource; + if(!current){ + //function called before main, default_memory resource was not initialied yet + current = new_delete_resource(); + } dlmalloc_global_sync_unlock(); return current; }