| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CS::Memory::Heap Class Reference

A separate heap from which memory can be allocated. More...

`#include <csutil/memheap.h>`

List of all members.

## Public Member Functions
void * | Alloc (const size_t n)
| Allocate a block of memory of size `n`.
void | Free (void *p)
| Free the block `p`.
void * | Realloc (void *p, size_t newSize)
| Resize the allocated block `p` to size `newSize`.
void | Trim (size_t pad=0)
| Try to return as much unused memory to the system as possible.

## Detailed Description

A separate heap from which memory can be allocated.

Remarks:
  Memory must be freed by the same heap it was allocated from.

  Thread-safe.

Definition at line 46 of file memheap.h.

## Member Function Documentation

void* CS::Memory::Heap::Alloc | ( | const size_t | n | ) |

Allocate a block of memory of size `n`.

void CS::Memory::Heap::Free | ( | void * | p | ) |

Free the block `p`.

void* CS::Memory::Heap::Realloc | ( | void * | p,
|  | size_t | newSize |
| ) |  |  |

Resize the allocated block `p` to size `newSize`.

void CS::Memory::Heap::Trim | ( | size_t | pad = `0` | ) |

Try to return as much unused memory to the system as possible.

`pad` optionally specifies a minimum amount of memory to be retained, in case future allocations are anticipated.

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

- csutil/memheap.h