Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends

nsFixedSizeAllocator Class Reference

#include <nsFixedSizeAllocator.h>

Collaboration diagram for nsFixedSizeAllocator:

List of all members.


struct  Bucket
struct  FreeEntry

Public Member Functions

 nsFixedSizeAllocator ()
 ~nsFixedSizeAllocator ()
nsresult Init (const char *aName, const size_t *aBucketSizes, PRInt32 aNumBuckets, PRInt32 aInitialSize, PRInt32 aAlign=0)
 Initialize the fixed size allocator.
void * Alloc (size_t aSize)
 Allocate a block of memory 'aSize' bytes big.
void Free (void *aPtr, size_t aSize)
 Free a pointer allocated using a fixed-size allocator.

Protected Member Functions

BucketAddBucket (size_t aSize)
BucketFindBucket (size_t aSize)

Protected Attributes

PLArenaPool mPool


struct Bucket
struct FreeEntry

Constructor & Destructor Documentation

nsFixedSizeAllocator::nsFixedSizeAllocator (  )  [inline]
nsFixedSizeAllocator::~nsFixedSizeAllocator (  )  [inline]

Member Function Documentation

Bucket* nsFixedSizeAllocator::AddBucket ( size_t  aSize  )  [protected]
void* nsFixedSizeAllocator::Alloc ( size_t  aSize  ) 

Allocate a block of memory 'aSize' bytes big.

Bucket* nsFixedSizeAllocator::FindBucket ( size_t  aSize  )  [protected]
void nsFixedSizeAllocator::Free ( void *  aPtr,
size_t  aSize 

Free a pointer allocated using a fixed-size allocator.

nsresult nsFixedSizeAllocator::Init ( const char *  aName,
const size_t *  aBucketSizes,
PRInt32  aNumBuckets,
PRInt32  aInitialSize,
PRInt32  aAlign = 0 

Initialize the fixed size allocator.

'aName' is used to tag the underlying PLArena object for debugging and measurement purposes. 'aNumBuckets' specifies the number of elements in 'aBucketSizes', which is an array of integral block sizes that this allocator should be prepared to handle.

Friends And Related Function Documentation

friend struct Bucket [friend]
friend struct FreeEntry [friend]

Member Data Documentation

The documentation for this class was generated from the following file: