# proto/Source/pool.h File Reference

Declaration of memory pool classes interface. More...

`#include <cassert>`
`#include <map>`

## Namespaces
namespace | ace
## Classes
class | ace::MemoryBlock< _Type >
| Memory block is designed to keep large continuous chunk of memory within and provides methods for subsequent transfer of small pieces to client subjects. More...
class | ace::MemoryPool< _Type, _Block >
| Definition of memory pool (abstract) interface. More...
class | ace::RandomSizedMemoryPool< _Type >
| RandomSizedMemoryPool, as its name suggests, allows to transfer various-sized chunks of memory. More...
class | ace::VoidPool
| VoidPool performs as pool of void type, although internally it's implementation is based on pool of char(s). More...

## Detailed Description

Declaration of memory pool classes interface.

Memory pools are designed to save 1.) place and 2.) time.

1.) Dynamic allocation of memory requires some extra space for information about the size of allocated memory piece (to let deallocator know how much memory should be retrieved). In case of small objects this information can be even as big as stored object. So if the memory for that kind of objects is allocated in big chunk, there is no extra space cost for each object.

2.) Frequent memory allocation is time consuming, so if performed only once in a while, the time is saved.

Of course memory pools have their disadvantages as well. The biggest one is the fact, that there is no way to deallocate only single object. Whole pool (or block) has to be deallocated at once. (Although it's not tough to add this kind of behavior to memory pool classes, but there is no need of it in PACE, so it would be useless overhead cost).

The memory pools are implemented as templates, so they can be used with various types.

(C) Ceslav Przywara 2008, MFF UK Prague