This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

testsuite allocator patch


Hi

A small patch for a small issue detected while playing with tracker_allocator. I considered that allocation count should represent the number of allocated bytes and not the number of requested bytes.

2011-09-01 François Dumont <frs.dumont@gmail.com>

* testsuite/util/testsuite_allocator.h (tracker_allocator_counter::allocate): Update
allocation count only if allocation succeeded.


Tested under linux x86_64.

François
Index: testsuite/util/testsuite_allocator.h
===================================================================
--- testsuite/util/testsuite_allocator.h	(revision 178124)
+++ testsuite/util/testsuite_allocator.h	(working copy)
@@ -41,8 +41,9 @@
     static void*
     allocate(size_type blocksize)
     {
+      void* p = ::operator new(blocksize);
       allocationCount_ += blocksize;
-      return ::operator new(blocksize);
+      return p;
     }
     
     static void

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