[llvm-commits] [llvm] r101130 - /llvm/trunk/lib/Support/Allocator.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Apr 13 09:21:46 PDT 2010


On Apr 13, 2010, at 7:41 AM, Benjamin Kramer wrote:
> 
> @@ -72,6 +70,8 @@
> /// Reset - Deallocate all but the current slab and reset the current pointer
> /// to the beginning of it, freeing all memory allocated so far.
> void BumpPtrAllocator::Reset() {
> +  if (!CurSlab) // Start a new slab if we didn't allocate one already.
> +    StartNewSlab();
>   DeallocateSlabs(CurSlab->NextPtr);
>   CurSlab->NextPtr = 0;
>   CurPtr = (char*)(CurSlab + 1);

Could you just return early here? I don't think Reset() need to allocate anything.






More information about the llvm-commits mailing list