diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2019-02-06 17:06:49 +0100 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2019-02-06 17:06:49 +0100 |
commit | d71017df63e2cb01a062d89bbd41d90584a755ff (patch) | |
tree | 77f6a3f918efa042551f3a4141af5b06a44cb463 /ACE/ace/Log_Msg.cpp | |
parent | 7169f72958484d5e9a8c229a86c5d4a7403d0581 (diff) | |
download | ATCD-d71017df63e2cb01a062d89bbd41d90584a755ff.tar.gz |
Removed ACE_NO_HEAP_CHECK macro because it is broken, see issue #733
* ACE/ace/Global_Macros.h:
* ACE/ace/Log_Msg.cpp:
* ACE/ace/OS_NS_Thread.cpp:
* ACE/ace/Service_Gestalt.cpp:
Diffstat (limited to 'ACE/ace/Log_Msg.cpp')
-rw-r--r-- | ACE/ace/Log_Msg.cpp | 92 |
1 files changed, 31 insertions, 61 deletions
diff --git a/ACE/ace/Log_Msg.cpp b/ACE/ace/Log_Msg.cpp index cc5cf7107a2..bc5f81933d3 100644 --- a/ACE/ace/Log_Msg.cpp +++ b/ACE/ace/Log_Msg.cpp @@ -166,8 +166,6 @@ int ACE_Log_Msg_Manager::init_backend (const u_long *flags) if (ACE_Log_Msg_Manager::log_backend_ == 0) { - ACE_NO_HEAP_CHECK; - #if (defined (WIN32) || !defined (ACE_LACKS_UNIX_SYSLOG)) && !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP) // Allocate the ACE_Log_Msg_Backend instance. if (ACE_BIT_ENABLED (ACE_Log_Msg_Manager::log_backend_flags_, ACE_Log_Msg::SYSLOG)) @@ -195,8 +193,6 @@ ACE_Log_Msg_Manager::get_lock (void) // to grab another one here. if (ACE_Log_Msg_Manager::lock_ == 0) { - ACE_NO_HEAP_CHECK; - ACE_NEW_RETURN (ACE_Log_Msg_Manager::lock_, ACE_Recursive_Thread_Mutex, 0); @@ -306,21 +302,18 @@ ACE_Log_Msg::instance (void) // Allocate the Singleton lock. ACE_Log_Msg_Manager::get_lock (); - { - ACE_NO_HEAP_CHECK; - if (ACE_Thread::keycreate (log_msg_tss_key (), - &ACE_TSS_CLEANUP_NAME) != 0) - { - if (1 == ACE_OS_Object_Manager::starting_up()) - //This function is called before ACE_OS_Object_Manager is - //initialized. So the lock might not be valid. Assume it's - //single threaded and so don't need the lock. - ; - else - ACE_OS::thread_mutex_unlock (lock); - return 0; // Major problems, this should *never* happen! - } - } + if (ACE_Thread::keycreate (log_msg_tss_key (), + &ACE_TSS_CLEANUP_NAME) != 0) + { + if (1 == ACE_OS_Object_Manager::starting_up()) + //This function is called before ACE_OS_Object_Manager is + //initialized. So the lock might not be valid. Assume it's + //single threaded and so don't need the lock. + ; + else + ACE_OS::thread_mutex_unlock (lock); + return 0; // Major problems, this should *never* happen! + } ACE_Log_Msg::key_created_ = true; } @@ -347,26 +340,20 @@ ACE_Log_Msg::instance (void) if (tss_log_msg == 0) { // Allocate memory off the heap and store it in a pointer in - // thread-specific storage (on the stack...). Stop heap - // checking, the memory will always be freed by the thread - // rundown because of the TSS callback set up when the key was - // created. This prevents from getting these blocks reported as - // memory leaks. - { - ACE_NO_HEAP_CHECK; - - ACE_NEW_RETURN (tss_log_msg, - ACE_Log_Msg, - 0); - // Store the dynamically allocated pointer in thread-specific - // storage. It gets deleted via the ACE_TSS_cleanup function - // when the thread terminates. - - if (ACE_Thread::setspecific (*(log_msg_tss_key()), - reinterpret_cast<void *> (tss_log_msg)) - != 0) - return 0; // Major problems, this should *never* happen! - } + // thread-specific storage (on the stack...). The memory will + // always be freed by the thread rundown because of the TSS + // callback set up when the key was created. + ACE_NEW_RETURN (tss_log_msg, + ACE_Log_Msg, + 0); + // Store the dynamically allocated pointer in thread-specific + // storage. It gets deleted via the ACE_TSS_cleanup function + // when the thread terminates. + + if (ACE_Thread::setspecific (*(log_msg_tss_key()), + reinterpret_cast<void *> (tss_log_msg)) + != 0) + return 0; // Major problems, this should *never* happen! } return tss_log_msg; @@ -548,14 +535,7 @@ ACE_Log_Msg::sync (const ACE_TCHAR *prog_name) ACE_OS::free ((void *) ACE_Log_Msg::program_name_); #endif /* ACE_HAS_ALLOC_HOOKS */ - // Stop heap checking, block will be freed by the destructor when - // the last ACE_Log_Msg instance is deleted. - // Heap checking state will be restored when the block is left. - { - ACE_NO_HEAP_CHECK; - - ACE_Log_Msg::program_name_ = ACE_OS::strdup (prog_name); - } + ACE_Log_Msg::program_name_ = ACE_OS::strdup (prog_name); } ACE_Log_Msg::msg_off_ = 0; @@ -799,19 +779,12 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name, ACE_OS::free ((void *) ACE_Log_Msg::program_name_); #endif /* ACE_HAS_ALLOC_HOOKS */ - // Stop heap checking, block will be freed by the destructor. - { - ACE_NO_HEAP_CHECK; - - ACE_ALLOCATOR_RETURN (ACE_Log_Msg::program_name_, - ACE_OS::strdup (prog_name), - -1); - } + ACE_ALLOCATOR_RETURN (ACE_Log_Msg::program_name_, + ACE_OS::strdup (prog_name), + -1); } else if (ACE_Log_Msg::program_name_ == 0) { - // Stop heap checking, block will be freed by the destructor. - ACE_NO_HEAP_CHECK; ACE_ALLOCATOR_RETURN (ACE_Log_Msg::program_name_, ACE_OS::strdup (ACE_TEXT ("<unknown>")), -1); @@ -3195,11 +3168,8 @@ ACE_Log_Msg::local_host (const ACE_TCHAR *s) #else ACE_OS::free ((void *) ACE_Log_Msg::local_host_); #endif /* ACE_HAS_ALLOC_HOOKS */ - { - ACE_NO_HEAP_CHECK; - ACE_ALLOCATOR (ACE_Log_Msg::local_host_, ACE_OS::strdup (s)); - } + ACE_ALLOCATOR (ACE_Log_Msg::local_host_, ACE_OS::strdup (s)); } } |