Logo Search packages:      
Sourcecode: maxdb-7.5.00 version File versions

LVCMem_BlockAllocator Class Reference

#include <LVCMem_BlockAllocator.hpp>

Inheritance diagram for LVCMem_BlockAllocator:

SAPDBMem_IBlockAllocator SAPDBMem_IAllocatorInfo

List of all members.


Detailed Description

Defines a block allocator as base of the OMS alloctor.

Only a singleton instance of this class is creatable. It is used to allocate MemoryPages for the OMS allocator. The allocator is allocating blocks of memory from the RTEMem_BlockAllocator. The allocator supervises the OMS heap limit and caches free blocks of memory for following requests. To be able to cache free blocks, a default request size has to be defined. Only free blocks of this size are cached. All other blocks are returend to the underlying RTEMem_BlockAllocator immediatly.

Definition at line 65 of file LVCMem_BlockAllocator.hpp.


Public Member Functions

virtual void * Allocate (SAPDB_ULong BlockCount)
 Allocates contiguous memory for 'BlockCount' blocks of memory.
virtual SAPDB_ULong CalcBlockCount (SAPDB_ULong NumberOfBytes) const
 Returns the number of blocks needed to allocate given number of bytes.
virtual void CalcStatistics (SAPDB_ULong &BytesUsed, SAPDB_ULong &MaxBytesUsed, SAPDB_ULong &BytesControlled)
 Outputs statistics about the memory usage of the allocator.
virtual void Deallocate (void *p, SAPDB_ULong BlockCount)
 Frees the memory.
virtual SAPDB_ULong GetAlignmentSize () const
 Returns the alignment size in bytes of the blocks that can be allocated by this allocator.
virtual void GetBaseAllocatorCallStatistics (SAPDB_ULong &CountAlloc, SAPDB_ULong &CountDealloc) const
 Outputs statistics about the number of Allocate and Deallocate calls of the allocator to the underlying base allocator.
virtual SAPDB_ULong GetBlockSize () const
 Returns the size in bytes of the blocks that can be allocated by this allocator. Returns blocksize setup by the constructor. Returns size of a system memory page in bytes.
virtual void GetCallStatistics (SAPDB_ULong &CountAlloc, SAPDB_ULong &CountDealloc) const
 Outputs statistics about the number of Allocate and Deallocate calls.
virtual int GetErrorCount () const
 Returns the number of errors found and corrected by the allocator Block allocator normally aren't able to provide this information.
virtual const SAPDB_UTF8 * GetIdentifier () const
 Returns the allocators name.
void SetDefaultBlockCount (SAPDB_ULong BlockCount)
 defines the default block size, i.e. the amount of memory, that normaly is required by the client. Only free blocks of this size can be cached by the allocator and will be reused by following requests.
void SetLimit (SAPDB_ULong limit)
 defines the maximal amount of memory provided by this allocator.

Static Public Member Functions

static SAPDB_ULong GetInvalidSize ()
 Returns the value for an invalid size. The is defined as 0xFFFF... .
static LVCMem_BlockAllocatorInstance ()
 returns a reference to the single instance of LVCMem_BlockAllocator. The first call of Instance will construct the singleton.

Private Member Functions

 LVCMem_BlockAllocator ()
 default constructor
void ReleaseFreeList ()
 releases all chunks of the free list

Private Attributes

SAPDB_ULong m_allocated
 number of allocated blocks
SAPDBMem_IBlockAllocatorm_allocator
 underlying Block Allocator
SAPDB_ULong m_CountAlloc
 number of calls of Allocate
SAPDB_ULong m_CountBaseAlloc
 number of calls of Allocate to base allocator
SAPDB_ULong m_CountBaseDealloc
 number of calls of Deallocate to base allocator
SAPDB_ULong m_CountDealloc
 number of calls of Deallocate
SAPDB_ULong m_defaultBlockCount
 default block size
NextPointer * m_firstFree
 pointer to first free block
SAPDB_ULong m_limit
 upper heap limit
RTESync_NamedSpinlock m_spinlock
 synchronization object
bool m_writeHeapLimitOpMsg
 true, if OMS_HEAP_LIMIT opmsg has to be written, if heap limit is reached

Static Private Attributes

static LVCMem_BlockAllocatorm_Instance = 0
 pointer to the singelton

Classes

struct  NextPointer

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

Generated by  Doxygen 1.6.0   Back to index