Used to Pre-Allocate Memory for commonly used types.
- To pre-allocate memory make use of the MakeAlloc API. This API takes the type for which reservation needs to be made and the number of blocks of memory which need to be reserved for this type. For example: MakeAlloc<X>(y), refers to a request to reserve "y" number of blocks of type "X".
- To get a memory block make use of the GetBlock API. This API returns a pointer to a block of memory, if blocks are available, else it throws a std::bad_alloc exception. This API is intended to be used in conjunction with the "placement new" operator. For example: To get a memory block of type X, use the API as follows:
=> X* xPtr = new (GetBlock<X>()) X(...);
- To free a memory block, retrieved via the Memory Pool, make use of the FreeBlock API, as follows:
=> FreeBlock<X>(xPtr);