RTEMS: cpukit/libcsupport/src/rtems_heap_greedy.c File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Functions
rtems_heap_greedy.c File Reference
Internal » Standard C Library Support » Malloc Support

Greedy Allocate that Empties the Heap. More...

`#include "malloc_p.h"`

## Functions
void * | rtems_heap_greedy_allocate (const uintptr_t *block_sizes, size_t block_count)
| Greedy allocate that empties the heap.
void * | rtems_heap_greedy_allocate_all_except_largest (uintptr_t *allocatable_size)
| Greedy allocate all blocks except the largest free block.
void | rtems_heap_greedy_free (void *opaque)
| Frees space of a greedy allocation.

## Detailed Description

Greedy Allocate that Empties the Heap.

## Function Documentation

## ◆ rtems_heap_greedy_allocate()

void * rtems_heap_greedy_allocate | ( | const uintptr_t * | block_sizes,
|  | size_t | block_count
| ) |  |

Greedy allocate that empties the heap.

Afterwards the heap has at most block_count allocatable blocks of sizes specified by block_sizes. The block_sizes must point to an array with block_count members. All other blocks are used.

See also
  rtems_heap_greedy_free().

## ◆ rtems_heap_greedy_allocate_all_except_largest()

void * rtems_heap_greedy_allocate_all_except_largest | ( | uintptr_t * | allocatable_size | ) |

Greedy allocate all blocks except the largest free block.

Afterwards the heap has at most one allocatable block. This block is the largest free block if it exists. The allocatable size of this block is stored in allocatable_size. All other blocks are used.

See also
  rtems_heap_greedy_free().

## ◆ rtems_heap_greedy_free()

void rtems_heap_greedy_free | ( | void * | opaque | ) |

Frees space of a greedy allocation.

The opaque argument must be the return value of rtems_heap_greedy_allocate() or rtems_heap_greedy_allocate_all_except_largest().