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

Benjamin Kramer benny.kra at googlemail.com
Tue Apr 13 09:39:40 PDT 2010


On 13.04.2010, at 18:21, Jakob Stoklund Olesen wrote:

> 
> 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.
> 

Sure *slaps head*

Thanks for the review, I changed the code in r101138.



More information about the llvm-commits mailing list