CS::Memory::Heap Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
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`.
size_t | Footprint ()
| Return the total amount of memory used for this heap.
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`.

size_t CS::Memory::Heap::Footprint | ( |  | ) |

Return the total amount of memory used for this heap.

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