ost::MemPager(3) | Library Functions Manual | ost::MemPager(3) |
NAME¶
ost::MemPager - The memory pager is used to allocate cumulative memory pages for storing object specific 'persistant' data that is presumed to persist during the life of a given derived object.SYNOPSIS¶
#include <misc.h> Inherited by ost::Keydata [protected], ost::SharedMemPager, and ost::StackPager [protected].Classes¶
struct _page
Public Member Functions¶
int getPages (void)
Protected Member Functions¶
virtual void * first (size_t size)
Friends¶
class String
Detailed Description¶
The memory pager is used to allocate cumulative memory pages for storing object specific 'persistant' data that is presumed to persist during the life of a given derived object.David Sugar dyfet@ostel.com Accumulative
object memory allocator.
Constructor & Destructor Documentation¶
ost::MemPager::MemPager (size_tpagesize = 4096) [protected]¶
Create a paged memory pool for cumulative storage. This pool allocates memory in fixed 'pagesize' chunks. Ideal performance is achived when the pool size matches the system page size. This pool can only exist in derived objects. Parameters:pagesize page size to allocate
chunks.
virtual ost::MemPager::~MemPager () [protected], [virtual]¶
Delete the memory pool and all allocated memory.Member Function Documentation¶
virtual void* ost::MemPager::alloc (size_tsize) [protected], [virtual]¶
Allocate memory from either the currently active page, or allocate a new page for the object. Parameters:size size of memory to allocate.
Returns:
pointer to allocated memory.
char* ost::MemPager::alloc (const char *str) [protected]¶
Allocate a string from the memory pager pool and copy the string inti it's new memory area. This checks only the last active page for available space before allocating a new page. Parameters:str string to allocate and copy into
paged memory pool.
Returns:
copy of string from allocated memory.
void ost::MemPager::clean (void) [protected]¶
Clean for memory cleanup before exiting.virtual void* ost::MemPager::first (size_tsize) [protected], [virtual]¶
Allocate first workspace from paged memory. This method scans all currently allocated blocks for available space before adding new pages and hence is both slower and more efficient. Parameters:size size of memory to allocate.
Returns:
pointer to allocated memory.
char* ost::MemPager::first (char *str) [protected]¶
Allocate a string from the memory pager pool and copy the string into it's new memory area. This method allocates memory by first searching for an available page, and then allocating a new page if no space is found. Parameters:str string to allocate and copy into
paged memory pool.
Returns:
copy of string from allocated memory.
int ost::MemPager::getPages (void) [inline]¶
Return the total number of pages that have been allocated for this memory pool. Returns:number of pages allocated.
void ost::MemPager::purge (void) [protected]¶
purge the current memory pool. Reimplemented in ost::SharedMemPager, and ost::StackPager.Friends And Related Function Documentation¶
friend class MemPagerObject [friend]¶
friend class String [friend]¶
Author¶
Generated automatically by Doxygen for GNU CommonC++ from the source code.Sat Jun 23 2012 | GNU CommonC++ |