Kaydet (Commit) 2d9beb78 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

OSL_TRACE in sal/rtl/source/alloc_*.cxx leads to deadlock...

...with SAL_LOG=+INFO due to std::ostringstream in log.cxx using global operator
new, which potentially calls rtl_allocateMemory.
üst 4821546a
This diff is collapsed.
This diff is collapsed.
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#include "alloc_impl.hxx" #include "alloc_impl.hxx"
#include "rtl/alloc.h" #include "rtl/alloc.h"
#include <sal/macros.h> #include <sal/macros.h>
#include <osl/diagnose.h>
#include <cassert>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
...@@ -41,7 +41,7 @@ AllocMode alloc_mode = AMode_UNSET; ...@@ -41,7 +41,7 @@ AllocMode alloc_mode = AMode_UNSET;
#if !defined(FORCE_SYSALLOC) #if !defined(FORCE_SYSALLOC)
static void determine_alloc_mode() static void determine_alloc_mode()
{ {
OSL_ASSERT(alloc_mode == AMode_UNSET); assert(alloc_mode == AMode_UNSET);
alloc_mode = (getenv("G_SLICE") == NULL ? AMode_CUSTOM : AMode_SYSTEM); alloc_mode = (getenv("G_SLICE") == NULL ? AMode_CUSTOM : AMode_SYSTEM);
} }
...@@ -108,7 +108,7 @@ SAL_CALL rtl_allocateMemory_CUSTOM (sal_Size n) SAL_THROW_EXTERN_C() ...@@ -108,7 +108,7 @@ SAL_CALL rtl_allocateMemory_CUSTOM (sal_Size n) SAL_THROW_EXTERN_C()
char * addr; char * addr;
sal_Size size = RTL_MEMORY_ALIGN(n + RTL_MEMALIGN, RTL_MEMALIGN); sal_Size size = RTL_MEMORY_ALIGN(n + RTL_MEMALIGN, RTL_MEMALIGN);
OSL_ASSERT(RTL_MEMALIGN >= sizeof(sal_Size)); assert(RTL_MEMALIGN >= sizeof(sal_Size));
if (n >= SAL_MAX_SIZE - (RTL_MEMALIGN + RTL_MEMALIGN - 1)) if (n >= SAL_MAX_SIZE - (RTL_MEMALIGN + RTL_MEMALIGN - 1))
{ {
/* requested size too large for roundup alignment */ /* requested size too large for roundup alignment */
...@@ -198,7 +198,7 @@ void rtl_memory_init() ...@@ -198,7 +198,7 @@ void rtl_memory_init()
#if !defined(FORCE_SYSALLOC) #if !defined(FORCE_SYSALLOC)
{ {
/* global memory arena */ /* global memory arena */
OSL_ASSERT(gp_alloc_arena == 0); assert(gp_alloc_arena == 0);
gp_alloc_arena = rtl_arena_create ( gp_alloc_arena = rtl_arena_create (
"rtl_alloc_arena", "rtl_alloc_arena",
...@@ -209,7 +209,7 @@ void rtl_memory_init() ...@@ -209,7 +209,7 @@ void rtl_memory_init()
rtl_arena_free, rtl_arena_free,
0 /* flags */ 0 /* flags */
); );
OSL_ASSERT(gp_alloc_arena != 0); assert(gp_alloc_arena != 0);
} }
{ {
sal_Size size; sal_Size size;
...@@ -233,7 +233,7 @@ void rtl_memory_init() ...@@ -233,7 +233,7 @@ void rtl_memory_init()
} }
} }
#endif #endif
OSL_TRACE("rtl_memory_init completed"); // SAL_INFO("sal", "rtl_memory_init completed");
} }
/* ================================================================= */ /* ================================================================= */
...@@ -263,7 +263,7 @@ void rtl_memory_fini() ...@@ -263,7 +263,7 @@ void rtl_memory_fini()
gp_alloc_arena = 0; gp_alloc_arena = 0;
} }
#endif #endif
OSL_TRACE("rtl_memory_fini completed"); // SAL_INFO("sal", "rtl_memory_fini completed");
} }
/* ================================================================= * /* ================================================================= *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment