RTEMS  5.0.0
Functions
rtems_heap_greedy.c File Reference

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. More...
 
void * rtems_heap_greedy_allocate_all_except_largest (uintptr_t *allocatable_size)
 Greedy allocate all blocks except the largest free block. More...
 
void rtems_heap_greedy_free (void *opaque)
 Frees space of a greedy allocation. More...
 

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().