LIBINT  2.1.0-stable
Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | List of all members
libint2::MemoryManager Class Referenceabstract

Class MemoryManager handles allocation and deallocation of raw memory (stack) provided at runtime of the library. More...

#include <memory.h>

Inheritance diagram for libint2::MemoryManager:
Inheritance graph
[legend]

Public Types

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
 

Public Member Functions

virtual Address alloc (const Size &size)=0
 Reserve a block and return its address.
 
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
 

Static Public Attributes

static const Address InvalidAddress = -1
 

Protected Types

typedef std::list< SafePtr< MemBlock > > memblkset
 

Protected Member Functions

 MemoryManager (const Size &maxmem)
 
Size maxmem () const
 Returns maxmem.
 
memblkset & blocks ()
 Returns blocks.
 
SafePtr< MemBlocksuperblock () const
 Returns the superblock.
 
SafePtr< MemBlocksteal_from_block (const SafePtr< MemBlock > &blk, const Size &size)
 steals size memory from block blk and returns the new block
 
SafePtr< MemBlockfind_block (const Address &a)
 finds the block at Address a
 

Detailed Description

Class MemoryManager handles allocation and deallocation of raw memory (stack) provided at runtime of the library.


The documentation for this class was generated from the following files: