This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Allocator in basic_string should default to __STL_DEFAULT_ALLOCATOR(charT)


Hi,

please consider the attached patch for inclusion in libstdc++.

To check for memory leaks, i'm using the hooks in malloc/realloc/free counting 
object allocation and deallocation. To this end, i use
#define __STL_DEFAULT_ALLOCATOR(T) malloc_alloc
so that all (de,re)allocations path through malloc/realloc/free.

But basic_string does not respect this macro, and from the style of the stl, i 
find this an omission or inconsistency.

In case i picked the wrong mean to make all of the stl use only malloc_alloc, 
please let me know.

Best regards,
- lars 
--- bastring.h.old	2002-09-24 15:47:43.000000000 +0200
+++ bastring.h	2002-09-24 15:47:16.000000000 +0200
@@ -62,7 +62,7 @@
 #endif
 
 template <class charT, class traits = string_char_traits<charT>,
-	  class Allocator = alloc >
+	  class Allocator = __STL_DEFAULT_ALLOCATOR(charT) >
 class basic_string
 {
 private:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]