[llvm-commits] CVS: poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 14 16:11:03 PST 2003


Changes in directory poolalloc/runtime/FreeListAllocator:

PoolAllocator.cpp updated: 1.28 -> 1.29

---
Log message:

Make sure to reserve space for the slabheader header as well


---
Diffs of the changes:  (+2 -1)

Index: poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp
diff -u poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.28 poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.29
--- poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.28	Fri Nov 14 16:05:39 2003
+++ poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp	Fri Nov 14 16:10:26 2003
@@ -65,7 +65,8 @@
   //
   if (NodesPerSlab > MaxNodesPerPage)
   {
-    NewSlab = (struct SlabHeader *) GetPages ((NodeSize * NodesPerSlab / PageSize) + 1);
+    unsigned NumBytes = sizeof(SlabHeader) + NodeSize * NodesPerSlab;
+    NewSlab = (struct SlabHeader *)GetPages((NumBytes+PageSize-1)/PageSize);
     if (NewSlab == NULL)
     {
       fprintf (stderr, "Failed large allocation\n");





More information about the llvm-commits mailing list