webengine/osswebengine/MemoryManager/Src/fast_malloc.cpp
changeset 8 7c90e6132015
parent 0 dd21522fd290
child 37 cb62a4f66ebe
--- a/webengine/osswebengine/MemoryManager/Src/fast_malloc.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/MemoryManager/Src/fast_malloc.cpp	Fri May 08 08:25:06 2009 +0300
@@ -1,3 +1,20 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*
+*/
 /*
   This is a version (aka dlmalloc) of malloc/free/realloc written by
   Doug Lea and released to the public domain, as explained at
@@ -4976,6 +4993,11 @@
     return oldmark;
 }
 
+#ifdef TRACE_CHUNK_USAGE
+void TraceChunkUsage(TInt aChunkHandle, TUint8* aBase, TInt aChunkSize);
+#else
+#define TraceChunkUsage(a,b,c)
+#endif
 void* symbian_mmap(size_t size)
 {
     size_t addr = (size_t)watermark;
@@ -5023,6 +5045,7 @@
     else
         oldmark = (void*)addr;
 
+    TraceChunkUsage(rchunk.Handle(),rchunk.Base(),rchunk.Size());
     MEM_LOGF( _L8("chunk size: %d"), rchunk.Size());
     return oldmark;
 }
@@ -5067,7 +5090,7 @@
                     // all three cells are adjacent
                     if (p->ptr + p->size == e->ptr) {
                         p->size += e->size;
-                        p->next = 0;
+                        p->next = e->next;
                         free(e);
                     }
                 } else if (cell->ptr + cell->size == e->ptr) {
@@ -5093,6 +5116,7 @@
         }
     }
 
+    TraceChunkUsage(rchunk.Handle(),rchunk.Base(),rchunk.Size());
     MEM_LOGF( _L8("chunk size: %d"), rchunk.Size());
     return 0;
 }