sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\heap\t_hcomp.cpp sl@0: // Causes lots of chunk compression without using much memory sl@0: // Won't work on WINS unless memory allocation limits are set. sl@0: // sl@0: // sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: const TUint size64k = 64*1024; sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: sl@0: RProcess me; sl@0: me.SetPriority(EPriorityHigh); sl@0: sl@0: TMemoryInfoV1Buf membuf; sl@0: UserHal::MemoryInfo(membuf); sl@0: TInt maxmem=membuf().iTotalRamInBytes; sl@0: TInt heapsize=maxmem*2; sl@0: sl@0: RHeap* heap1=User::ChunkHeap(NULL,size64k,heapsize+size64k); sl@0: if (heap1==NULL) sl@0: return KErrNoMemory; sl@0: sl@0: FOREVER sl@0: { sl@0: TUint8* ptr=(TUint8*)heap1->Alloc(heapsize); // fail, compress, fail sl@0: User::After(1000); // quite soon sl@0: heap1->Free(ptr); sl@0: } sl@0: return 0; sl@0: }