[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LReentrantMemoryPool



Overview:

LReentrantMemoryPool is a PowerPlant class that is areentrant memory manager for use by interrupt callbacks. Based on the NEWMODE_FAST implementation of operator new.

Methods :

The methods in this class are:

 

LReentrantMemoryPool()  
~LReentrantMemoryPool()  
AddPool()  
AllocFrom()  
DisposePtr()  
FreeMem()  
GetPtrSize()  
MakeFreeBlock()  
NewPtr()  
NewPtrClear()  
TotalMem()  
 

Data Members:

The data members in this class are:

 

mMemoryPools  
mFreeBlocks;  

Source files:

(Networking Classes)

LReentrantMemoryPool.h

LReentrantMemoryPool.cp

See also:

LSharedMemoryPool

LReentrantMemoryPool()

Purpose:

The constructor creates the object, specifying the initial size of the memory pool.

IMPORTANT: MUST NOT BE CALLED AT INTERRUPT TIME!

Access :

Public

Prototype :

LReentrantMemoryPool (UInt32 inInitialSize);

LReentrantMemoryPool();		// do not use

LReentrantMemoryPool(LReentrantMemoryPool&);
Parameters:

The parameters for this constructor are:

 

UInt32 inInitialSize The initial size of the pool.

~LReentrantMemoryPool()

Purpose:

The destructor destroys the object.

Access :

Virtual, Public

Prototype:

virtual ~LReentrantMemoryPool();

AddPool()

Purpose:

Add a memory pool.

Access :

Public

Prototype:

void AddPool (UInt32 inPoolSize);
Parameters:

The parameters for this method are:

 

UInt32 inPoolSize The size of the pool.

Return:

None

AllocFrom()

Purpose:

Allocate memory from the pool.

Access :

Private

Prototype:

void* AllocFrom (SFreeBlockInfo* inBlockInfo,
   UInt32 inByteCount);
Parameters:

The parameters for this method are:

 

SFreeBlockInfo* inBlockInfo The block information.
UInt32 inByteCount The number of bytes.

Return:

The buffer pointer.

DisposePtr()

Purpose:

Free a non-relocatable block from this memory pool. May be called at interrupt time.

Access :

Public

Prototype:

void DisposePtr (void* inPtr);
Parameters:

The parameters for this method are:

 

void* inPtr The pointer.

Return:

None

FreeMem()

Purpose:

Return the total amount of free memory in this memory pool. May be called at interrupt time.

Access :

Public

Prototype:

UInt32 FreeMem (void);
Parameters:

None

Return:

The amount of free memory in the pool.

GetPtrSize()

Purpose:

Return the size of the non-relocatable block at inPtr. NOTE: The size will be rounded up to the nearest multiple of 4. May be called at interrupt time.

Access :

Public

Prototype:

UInt32 GetPtrSize (void* inPtr);
Parameters:

The parameters for this method are:

 

void* inPtr The pointer.

Return:

The size of the memory block.

MakeFreeBlock()

Purpose:

Create a free block.

Access :

Private

Prototype:

void MakeFreeBlock (void* inBlock, 
   UInt32 inByteCount);
Parameters:

The parameters for this method are:

 

void* inBlock The pointer.
UInt32 inByteCount The byte count.

Return:

None

NewPtr()

Purpose:

Allocate a new non-relocatable block within the reentrant memory pool. May be called at interrupt time.

Access :

Public

Prototype:

void* NewPtr (UInt32 inByteCount);
Parameters:

The parameters for this method are:

 

UInt32 inByteCount The byte count.

Return:

The pointer.

NewPtrClear()

Purpose:

Allocate a new non-relocatable block and clear it. May be called at interrupt time.

Access :

Public

Prototype:

void* NewPtrClear (UInt32 inByteCount);
Parameters:

The parameters for this method are:

 

UInt32 inByteCount The byte count.

Return:

The pointer.

TotalMem()

Purpose:

Return the total amount of memory used by this memory pool. May be called at interrupt time.

Access :

Public

Prototype:

UInt32 TotalMem (void);
Parameters:

None

Return:

The total memory in the pool.

mMemoryPools

Purpose:

The pools.

Access :

Private

Prototype:

LInterruptSafeList mMemoryPools;

mFreeBlocks;

Purpose:

The free blocks in the pool.

Access :

Private

Prototype:

LInterruptSafeList mFreeBlocks;

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000