#include <elm/alloc/BlockAllocatorWithGC.h>
Implements the block allocator whose the template form is BlockAllocatorWithGC.
elm::AbstractBlockAllocatorWithGC::AbstractBlockAllocatorWithGC |
( |
t::size |
block_size, |
|
|
t::size |
chunk_size = 1 << 20 |
|
) |
| |
elm::AbstractBlockAllocatorWithGC::~AbstractBlockAllocatorWithGC |
( |
void |
| ) |
|
|
virtual |
void * elm::AbstractBlockAllocatorWithGC::allocate |
( |
void |
| ) |
|
throw | ( | BadAlloc |
| ) | | |
void * elm::AbstractBlockAllocatorWithGC::allocate |
( |
t::size |
size | ) |
|
throw | ( | BadAlloc |
| ) | | |
Allocate a block of the given size. This function accepts as size only the size of elements.
- Parameters
-
- Returns
- Allocated block.
- Exceptions
-
void elm::AbstractBlockAllocatorWithGC::beginGC |
( |
void |
| ) |
|
|
protectedvirtual |
Possibly overridden by the actual implementation, called before starting the garbage collection. As a default, do nothing.
Referenced by collectGarbage().
t::size elm::AbstractBlockAllocatorWithGC::blockSize |
( |
void |
| ) |
const |
Get the block size.
- Returns
- Block size (in bytes).
t::size elm::AbstractBlockAllocatorWithGC::chunkSize |
( |
void |
| ) |
const |
Get the memory chunk size.
- Returns
- Memory chunk size (in bytes).
void elm::AbstractBlockAllocatorWithGC::collect |
( |
void |
| ) |
|
|
protectedpure virtual |
This method must be overridden by the actual implementation of the allocation to perform living block collection, that is, call the mark() method for each living block.
Referenced by collectGarbage().
void elm::AbstractBlockAllocatorWithGC::collectGarbage |
( |
void |
| ) |
|
void elm::AbstractBlockAllocatorWithGC::endGC |
( |
void |
| ) |
|
|
protectedvirtual |
Possibly overridden by the actual implementation, called after ending the garbage collection. As a default, do nothing.
Referenced by collectGarbage().
void elm::AbstractBlockAllocatorWithGC::free |
( |
void * |
block | ) |
|
Function for compatibility with Allocator concept. Do nothing yet.
- Parameters
-
int elm::AbstractBlockAllocatorWithGC::freeCount |
( |
void |
| ) |
const |
bool elm::AbstractBlockAllocatorWithGC::mark |
( |
void * |
ptr | ) |
|
|
protected |
int elm::AbstractBlockAllocatorWithGC::totalCount |
( |
void |
| ) |
const |
int elm::AbstractBlockAllocatorWithGC::usedCount |
( |
void |
| ) |
const |
Get the count of apparently used. This count is only precise just after a garbage collection. Else it may includes non-living blocks that have not been already collected.
- Returns
- In-use blocks.
References freeCount(), and totalCount().
int elm::AbstractBlockAllocatorWithGC::free_cnt |
|
protected |
free_t* elm::AbstractBlockAllocatorWithGC::free_list |
|
protected |
The documentation for this class was generated from the following files: