|
LIBINT 2.9.0
|
LastFitMemoryManager allocates memory by finding last suitable free block. More...
#include <memory.h>


Public Member Functions | |
| LastFitMemoryManager (bool search_exact=true, const Size &maxsize=ULONG_MAX) | |
| Address | alloc (const Size &size) override |
| Implementation of MemoryManager::alloc() | |
Public Member Functions inherited from libint2::MemoryManager | |
| 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 | |
Public Types inherited from libint2::MemoryManager | |
| 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 Public Attributes inherited from libint2::MemoryManager | |
| static const Address | InvalidAddress = -1 |
Protected Types inherited from libint2::MemoryManager | |
| typedef std::list< std::shared_ptr< MemBlock > > | memblkset |
Protected Member Functions inherited from libint2::MemoryManager | |
| MemoryManager (const Size &maxmem) | |
| Size | maxmem () const |
| Returns maxmem. | |
| memblkset & | blocks () |
| Returns blocks. | |
| std::shared_ptr< MemBlock > | superblock () const |
| Returns the superblock. | |
| std::shared_ptr< MemBlock > | steal_from_block (const std::shared_ptr< MemBlock > &blk, const Size &size) |
| steals size memory from block blk and returns the new block | |
| std::shared_ptr< MemBlock > | find_block (const Address &a) |
| finds the block at Address a | |
LastFitMemoryManager allocates memory by finding last suitable free block.
If search_exact == true – exact fit is sought first (from the back of the list).
|
overridevirtual |
Implementation of MemoryManager::alloc()
Implements libint2::MemoryManager.
References libint2::MemoryManager::blocks(), libint2::MemoryBlock< A, S >::is_free(), libint2::MemoryManager::maxmem(), libint2::MemoryBlock< A, S >::size_eq(), libint2::MemoryBlock< A, S >::size_geq(), libint2::MemoryManager::steal_from_block(), and libint2::MemoryManager::superblock().