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

John Criswell criswell at cs.uiuc.edu
Thu Nov 13 12:04:12 PST 2003


Changes in directory poolalloc/runtime/FreeListAllocator:

PoolAllocator.cpp updated: 1.15 -> 1.16

---
Log message:

In poolalloc(), changed the calculation of the number of nodes to allocate
in an array so that we don't waste a block if we fall on a node size
boundary.
Thanks to Chris for suggesting the change.



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

Index: poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp
diff -u poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.15 poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.16
--- poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp:1.15	Thu Nov 13 11:46:00 2003
+++ poolalloc/runtime/FreeListAllocator/PoolAllocator.cpp	Thu Nov 13 12:03:10 2003
@@ -261,7 +261,7 @@
   //
   if (Pool->NodeSize < BytesWanted)
   {
-    return (poolallocarray (Pool, (BytesWanted / Pool->NodeSize) + 1));
+    return (poolallocarray (Pool, (BytesWanted+Pool->NodeSize-1)/Pool->NodeSize));
   }
 
   //





More information about the llvm-commits mailing list