Moved emptyChunk_ assignment because code depends upon it. And added if

statement before line where allocChunk_ is assigned.


git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@296 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rich_sposato 2005-10-13 22:41:05 +00:00
parent 01349cc358
commit a810fb8d0f

View file

@ -414,9 +414,7 @@ bool FixedAllocator::TrimEmptyChunk( void )
assert( lastChunk->HasAvailable( numBlocks_ ) ); assert( lastChunk->HasAvailable( numBlocks_ ) );
lastChunk->Release(); lastChunk->Release();
chunks_.pop_back(); chunks_.pop_back();
emptyChunk_ = NULL;
assert( 0 == CountEmptyChunks() );
if ( chunks_.empty() ) if ( chunks_.empty() )
{ {
allocChunk_ = NULL; allocChunk_ = NULL;
@ -436,6 +434,9 @@ bool FixedAllocator::TrimEmptyChunk( void )
} }
} }
emptyChunk_ = NULL;
assert( 0 == CountEmptyChunks() );
return true; return true;
} }
@ -622,7 +623,8 @@ void FixedAllocator::DoDeallocate(void* p)
assert( lastChunk->HasAvailable( numBlocks_ ) ); assert( lastChunk->HasAvailable( numBlocks_ ) );
lastChunk->Release(); lastChunk->Release();
chunks_.pop_back(); chunks_.pop_back();
allocChunk_ = deallocChunk_; if ( allocChunk_->IsFilled() )
allocChunk_ = deallocChunk_;
} }
emptyChunk_ = deallocChunk_; emptyChunk_ = deallocChunk_;
} }
@ -811,6 +813,10 @@ void SmallObjAllocator::Deallocate( void * p )
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// $Log$ // $Log$
// Revision 1.8 2005/10/13 22:41:05 rich_sposato
// Moved emptyChunk_ assignment because code depends upon it. And added if
// statement before line where allocChunk_ is assigned.
//
// Revision 1.7 2005/09/27 00:40:30 rich_sposato // Revision 1.7 2005/09/27 00:40:30 rich_sposato
// Moved Chunk out of FixedAllocator class so I could improve efficiency for // Moved Chunk out of FixedAllocator class so I could improve efficiency for
// SmallObjAllocator::Deallocate. // SmallObjAllocator::Deallocate.