[llvm-commits] [llvm] r41728 - in /llvm/trunk: include/llvm/Support/Allocator.h lib/Support/Allocator.cpp

Chris Lattner clattner at apple.com
Wed Sep 5 17:03:02 PDT 2007


On Sep 5, 2007, at 2:41 PM, Evan Cheng wrote:

> ====================================================================== 
> ========
> --- llvm/trunk/lib/Support/Allocator.cpp (original)
> +++ llvm/trunk/lib/Support/Allocator.cpp Wed Sep  5 16:41:34 2007
> @@ -92,6 +92,12 @@
>    ((MemRegion*)TheMemory)->Deallocate();
>  }
>
> +void BumpPtrAllocator::Reset() {
> +  ((MemRegion*)TheMemory)->Deallocate();
> +  TheMemory = malloc(4096);
> +  ((MemRegion*)TheMemory)->Init(4096, 1, 0);
> +}
> +

This is correct, but it would be more efficient to avoid deallocating  
the first chunk, which is what requires reallocating it immediately.

-Chris



More information about the llvm-commits mailing list