From 6b6854d53e6da670c959cce4653b351ca53060f4 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Thu, 8 Dec 2005 22:23:33 +0000 Subject: [PATCH] Added checks for whether loki's allocator is corrupted. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@379 7ec92016-0320-0410-acc4-a06ded1c099a --- test/SmallObj/SmallObjBench.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/SmallObj/SmallObjBench.cpp b/test/SmallObj/SmallObjBench.cpp index 379f888..46af2ca 100755 --- a/test/SmallObj/SmallObjBench.cpp +++ b/test/SmallObj/SmallObjBench.cpp @@ -243,16 +243,19 @@ LOKI_SMALLOBJ_BENCH_ARRAY(new_del_a_on_a_all,std::allocator st , cout << endl << endl; #endif +#define LOKI_ALLOCATOR_PARAMETERS Loki::SingleThreaded, 4096, 32, 4, Loki::NoDestroy + template void testSize() { typedef Base A; - typedef Base > B; - typedef Base > C; + typedef Base > B; + typedef Base > C; #ifdef COMPARE_BOOST_POOL typedef BoostPoolNew D; #endif + assert( !Loki::AllocatorSingleton< LOKI_ALLOCATOR_PARAMETERS >::IsCorrupted() ); cout << endl << endl; cout << "Allocator Benchmark Tests with " << Size << " bytes big objects " << endl; cout << endl; @@ -275,21 +278,26 @@ void testSize() cout << loop << " times "; LOKI_SMALLOBJBECH_ABCD(delete_new ,0,loop,t,"'delete new T'"); + assert( !Loki::AllocatorSingleton< LOKI_ALLOCATOR_PARAMETERS >::IsCorrupted() ); cout << "N=" << N <<" : " << loop << " times "; LOKI_SMALLOBJBECH_ABCD(delete_new_array ,N,loop,t,"'delete[] new T[N]'"); + assert( !Loki::AllocatorSingleton< LOKI_ALLOCATOR_PARAMETERS >::IsCorrupted() ); cout << "i=0..." << Narr << " : "; LOKI_SMALLOBJBECH_ABCD(new_del_on_arr ,0,Narr,t,"1. 'arr[i] = new T' 2. 'delete arr[i]'"); + assert( !Loki::AllocatorSingleton< LOKI_ALLOCATOR_PARAMETERS >::IsCorrupted() ); cout << "i=0..." << Narr << ", N=" << N <<" : "; LOKI_SMALLOBJBECH_ABCD(new_del_a_on_a ,N,Narr,t,"1. 'arr[i] = new T[N]' 2. 'delete[] arr[i]'"); + assert( !Loki::AllocatorSingleton< LOKI_ALLOCATOR_PARAMETERS >::IsCorrupted() ); delete [] a; cout << "_________________________________________________________________" << endl; - Loki::AllocatorSingleton<>::ClearExtraMemory(); + assert( !Loki::AllocatorSingleton< LOKI_ALLOCATOR_PARAMETERS >::IsCorrupted() ); + Loki::AllocatorSingleton< LOKI_ALLOCATOR_PARAMETERS >::ClearExtraMemory(); } @@ -318,6 +326,9 @@ int main() // ---------------------------------------------------------------------------- // $Log$ +// Revision 1.16 2005/12/08 22:23:33 rich_sposato +// Added checks for whether loki's allocator is corrupted. +// // Revision 1.15 2005/11/02 01:46:04 rich_sposato // Added explanatory comment about why class has no new [] and delete [] // operators. Removed other comment which is now useless.