uninline-fixedmalloc
author Benjamin Smedberg <benjamin@smedbergs.us>
Sun, 20 Apr 2008 21:43:09 -0400
changeset 42 53c5098cb79e0223016b6901194a89d913f235fb
permissions -rw-r--r--
Updates and imports

diff --git a/MMgc/FixedMalloc.cpp b/MMgc/FixedMalloc.cpp
--- a/MMgc/FixedMalloc.cpp
+++ b/MMgc/FixedMalloc.cpp
@@ -122,6 +122,41 @@
 		GCAssert(instance != NULL);
 		delete instance;
 		instance = NULL;
+	}
+
+	void* FixedMalloc::Alloc(size_t size)
+	{
+		void *item;
+		GCAssert(size + 3 > size);
+		// overflow detection
+		if(size+3 < size)
+			return NULL;
+		size = (size+3)&~3;
+		if (size <= (size_t)kLargestAlloc) {
+			item = FindSizeClass(size)->Alloc(size);
+		} else {
+			item = LargeAlloc(size);
+		}
+		VALGRIND_MEMPOOL_ALLOC(this, item, size);
+		VALGRIND_CHECK_MEM_IS_DEFINED(item, size);
+		fprintf(stderr, "FixedMalloc::Alloc = %p\n", item);
+		return item;
+	}
+		
+	void FixedMalloc::Free(void *item)
+	{
+		if(item == 0)
+			return;
+
+		VALGRIND_MEMPOOL_FREE(this, item);
+		
+		// small things are never allocated on the 4K boundary b/c the block
+		// header structure is stored there, large things always are		
+		if(IsLargeAlloc(item)) {
+			LargeFree(item);
+		} else {		
+			FixedAllocSafe::GetFixedAllocSafe(item)->Free(item);
+		}
 	}
 
 	FixedMalloc::FixedMalloc(GCHeap* heap)
diff --git a/MMgc/FixedMalloc.h b/MMgc/FixedMalloc.h
--- a/MMgc/FixedMalloc.h
+++ b/MMgc/FixedMalloc.h
@@ -62,40 +62,8 @@
 			return instance;
 		}
 
-		inline void* Alloc(size_t size)
-		{
-			void *item;
-			GCAssert(size + 3 > size);
-			// overflow detection
-			if(size+3 < size)
-				return NULL;
-			size = (size+3)&~3;
-			if (size <= (size_t)kLargestAlloc) {
-				item = FindSizeClass(size)->Alloc(size);
-			} else {
-				item = LargeAlloc(size);
-			}
-                        VALGRIND_MEMPOOL_ALLOC(this, item, size);
-			VALGRIND_CHECK_MEM_IS_DEFINED(item, size);
-			fprintf(stderr, "FixedMalloc::Alloc = %p\n", item);
-			return item;
-		}
-
-		inline void Free(void *item)
-		{
-			if(item == 0)
-				return;
-
-			VALGRIND_MEMPOOL_FREE(this, item);
-
-			// small things are never allocated on the 4K boundary b/c the block
-			// header structure is stored there, large things always are		
-			if(IsLargeAlloc(item)) {
-				LargeFree(item);
-			} else {		
-				FixedAllocSafe::GetFixedAllocSafe(item)->Free(item);
-			}
-		}
+		void* Alloc(size_t size);
+		void Free(void *item);
 
 		size_t Size(const void *item)
 		{