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. Accumulative object memory allocator.
More...
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. Accumulative object memory allocator.
When the object is destroyed, all accumulated data is automatically purged.
There are a number of odd and specialized utility classes found in Common C++. The most common of these is the "MemPager" class. This is basically a class to enable page-grouped "cumulative" memory allocation; all accumulated allocations are dropped during the destructor. This class has found it's way in a lot of other utility classes in Common C++.
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
to allocate chunks.
MemPager::~MemPager (
) [protected, virtual]
Delete the memory pool and all allocated memory.
Member Function Documentation
char * MemPager::alloc (
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
to allocate and copy into paged memory pool.
Returns:
copy of string from allocated memory.
void * MemPager::alloc (
size_t size ) [protected, virtual]
Allocate memory from either the currently active page, or allocate a new page for the object.