diff options
author | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-09 16:36:46 +0000 |
---|---|---|
committer | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-09 16:36:46 +0000 |
commit | 0ab20ff8989e713fe53e4c34b25753c1d469fd4e (patch) | |
tree | 1965b1915e8ccaf17820b9f148f88fef78a5c66f | |
parent | ceb4ca9242d710695157779f845b75183974164c (diff) | |
download | ATCD-0ab20ff8989e713fe53e4c34b25753c1d469fd4e.tar.gz |
ChangeLogTag:Wed Apr 9 15:51:32 UTC 2003 Don Hinton <dhinton@dresystems.com>
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ace/Malloc_Allocator.cpp | 32 | ||||
-rw-r--r-- | ace/Malloc_Allocator.i | 26 |
3 files changed, 41 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog index 9265a1ac9a4..c12df4fc106 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed Apr 9 15:51:32 UTC 2003 Don Hinton <dhinton@dresystems.com> + + * ace/Malloc_Allocator.{i,cpp}: + + Uninlined ACE_New_Allocator::{malloc, calloc, free} () to + avoid the multiple heap problem on systems like Windows. + Thanks to Gonzalo Diethelm <gonzalo.diethelm@aditiva.com> + for reporting the problem. This fixes bug [1464]. + Wed Apr 09 17:04:01 2003 Simon McQueen <sm@prismtechnologies.com> * apps/mkcsregdb/mkcsregdb.dsp: Added missing library in release diff --git a/ace/Malloc_Allocator.cpp b/ace/Malloc_Allocator.cpp index 9c119f904c2..73885536cb9 100644 --- a/ace/Malloc_Allocator.cpp +++ b/ace/Malloc_Allocator.cpp @@ -113,6 +113,38 @@ ACE_Allocator::ACE_Allocator (void) ACE_TRACE ("ACE_Allocator::ACE_Allocator"); } +/******************************************************************************/ + +void * +ACE_New_Allocator::malloc (size_t nbytes) +{ + char *ptr = 0; + + if (nbytes > 0) + ACE_NEW_RETURN (ptr, char[nbytes], 0); + return (void *) ptr; +} + +void * +ACE_New_Allocator::calloc (size_t nbytes, + char initial_value) +{ + char *ptr = 0; + + ACE_NEW_RETURN (ptr, char[nbytes], 0); + + ACE_OS::memset (ptr, initial_value, nbytes); + return (void *) ptr; +} + +void +ACE_New_Allocator::free (void *ptr) +{ + delete [] (char *) ptr; +} + +/******************************************************************************/ + void ACE_Static_Allocator_Base::dump (void) const { diff --git a/ace/Malloc_Allocator.i b/ace/Malloc_Allocator.i index b0cfd89b218..55aba21992e 100644 --- a/ace/Malloc_Allocator.i +++ b/ace/Malloc_Allocator.i @@ -1,26 +1,5 @@ // $Id$ -ACE_INLINE void * -ACE_New_Allocator::malloc (size_t nbytes) -{ - char *ptr = 0; - - if (nbytes > 0) - ACE_NEW_RETURN (ptr, char[nbytes], 0); - return (void *) ptr; -} - -ACE_INLINE void * -ACE_New_Allocator::calloc (size_t nbytes, - char initial_value) -{ - char *ptr = 0; - - ACE_NEW_RETURN (ptr, char[nbytes], 0); - - ACE_OS::memset (ptr, initial_value, nbytes); - return (void *) ptr; -} ACE_INLINE void * ACE_New_Allocator::calloc (size_t n_elem, size_t elem_size, char initial_value) @@ -28,11 +7,6 @@ ACE_New_Allocator::calloc (size_t n_elem, size_t elem_size, char initial_value) return ACE_New_Allocator::calloc (n_elem * elem_size, initial_value); } -ACE_INLINE void -ACE_New_Allocator::free (void *ptr) -{ - delete [] (char *) ptr; -} ACE_INLINE int ACE_New_Allocator::remove (void) |