LIBINT
2.1.0-stable
|
WorstFitMemoryManager allocates memory by trying to find the largest-possible free block. More...
#include <memory.h>
Public Member Functions | |
WorstFitMemoryManager (bool search_exact=true, const Size &maxsize=ULONG_MAX) | |
Address | alloc (const Size &size) |
Implementation of MemoryManager::alloc() | |
![]() | |
virtual void | free (const Address &address) |
Release a block previously reserved using alloc. | |
Size | max_memory_used () const |
Returns the max amount of memory used up to this moment. | |
void | reset () |
resets the state of MemoryManager; does not invalidate stats, however | |
Additional Inherited Members | |
![]() | |
typedef intptr_t | Address |
Negative Address is used to denote an invalid address – hence signed integer. | |
typedef size_t | Size |
typedef MemoryBlock< Address, Size > | MemBlock |
![]() | |
static const Address | InvalidAddress = -1 |
![]() | |
typedef std::list< SafePtr< MemBlock > > | memblkset |
![]() | |
MemoryManager (const Size &maxmem) | |
Size | maxmem () const |
Returns maxmem. | |
memblkset & | blocks () |
Returns blocks. | |
SafePtr< MemBlock > | superblock () const |
Returns the superblock. | |
SafePtr< MemBlock > | steal_from_block (const SafePtr< MemBlock > &blk, const Size &size) |
steals size memory from block blk and returns the new block | |
SafePtr< MemBlock > | find_block (const Address &a) |
finds the block at Address a | |
WorstFitMemoryManager allocates memory by trying to find the largest-possible free block.
If search_exact == true – exact fit is sought first.