RTEMS
Macros | Typedefs | Enumerations | Functions
heapimpl.h File Reference

Heap Handler Implementation. More...

#include <rtems/score/heap.h>

Go to the source code of this file.

Macros

#define HEAP_PREV_BLOCK_USED   ((uintptr_t) 1)
 See also Heap_Block::size_and_flag.
 
#define HEAP_ALLOC_BONUS   sizeof(uintptr_t)
 Size of the part at the block begin which may be used for allocation in charge of the previous block.
 
#define _Heap_Protection_block_initialize(heap, block)   ((void) 0)
 
#define _Heap_Protection_block_check(heap, block)   ((void) 0)
 
#define _Heap_Protection_block_error(heap, block, reason)   ((void) 0)
 
#define _Heap_Protection_free_all_delayed_blocks(heap)   ((void) 0)
 
#define _HAssert(cond)   ((void) 0)
 

Typedefs

typedef bool(* Heap_Block_visitor) (const Heap_Block *block, uintptr_t block_size, bool block_is_used, void *visitor_arg)
 Heap block visitor. More...
 

Enumerations

enum  Heap_Resize_status { HEAP_RESIZE_SUCCESSFUL, HEAP_RESIZE_UNSATISFIED, HEAP_RESIZE_FATAL_ERROR }
 See _Heap_Resize_block().
 

Functions

bool _Heap_Get_first_and_last_block (uintptr_t heap_area_begin, uintptr_t heap_area_size, uintptr_t page_size, uintptr_t min_block_size, Heap_Block **first_block_ptr, Heap_Block **last_block_ptr)
 Gets the first and last block for the heap area. More...
 
uintptr_t _Heap_Initialize (Heap_Control *heap, void *area_begin, uintptr_t area_size, uintptr_t page_size)
 Initializes the heap control block. More...
 
void * _Heap_Allocate_aligned_with_boundary (Heap_Control *heap, uintptr_t size, uintptr_t alignment, uintptr_t boundary)
 Allocates an aligned memory area with boundary constraint. More...
 
RTEMS_INLINE_ROUTINE void * _Heap_Allocate_aligned (Heap_Control *heap, uintptr_t size, uintptr_t alignment)
 Allocates an aligned memory area. More...
 
RTEMS_INLINE_ROUTINE void * _Heap_Allocate (Heap_Control *heap, uintptr_t size)
 Allocates a memory area. More...
 
bool _Heap_Free (Heap_Control *heap, void *addr)
 Frees the allocated memory area. More...
 
bool _Heap_Walk (Heap_Control *heap, int source, bool dump)
 Verifies the integrity of the heap. More...
 
void _Heap_Iterate (Heap_Control *heap, Heap_Block_visitor visitor, void *visitor_arg)
 Iterates over all blocks of the heap. More...
 
Heap_Block_Heap_Greedy_allocate (Heap_Control *heap, const uintptr_t *block_sizes, size_t block_count)
 Greedily allocates and empties the heap. More...
 
Heap_Block_Heap_Greedy_allocate_all_except_largest (Heap_Control *heap, uintptr_t *allocatable_size)
 Greedily allocates all blocks except the largest free block. More...
 
void _Heap_Greedy_free (Heap_Control *heap, Heap_Block *blocks)
 Frees blocks of a greedy allocation. More...
 
void _Heap_Get_information (Heap_Control *heap, Heap_Information_block *info)
 Returns information about used and free blocks for the heap. More...
 
void _Heap_Get_free_information (Heap_Control *heap, Heap_Information *info)
 Returns information about free blocks for the heap. More...
 
bool _Heap_Size_of_alloc_area (Heap_Control *heap, void *addr, uintptr_t *size)
 Returns the size of the allocatable memory area. More...
 
Heap_Resize_status _Heap_Resize_block (Heap_Control *heap, void *addr, uintptr_t size, uintptr_t *old_size, uintptr_t *new_size)
 Resizes the block of the allocated memory area. More...
 
Heap_Block_Heap_Block_allocate (Heap_Control *heap, Heap_Block *block, uintptr_t alloc_begin, uintptr_t alloc_size)
 Allocates the memory area. starting at alloc_begin of size alloc_size bytes in the block block. More...
 
RTEMS_INLINE_ROUTINE void _Heap_Protection_set_delayed_free_fraction (Heap_Control *heap, uintptr_t fraction)
 Sets the fraction of delayed free blocks that is actually freed during memory shortage. More...
 
RTEMS_INLINE_ROUTINE Heap_Block_Heap_Free_list_head (Heap_Control *heap)
 Returns the head of the free list of the heap. More...
 
RTEMS_INLINE_ROUTINE Heap_Block_Heap_Free_list_tail (Heap_Control *heap)
 Returns the tail of the free list of the heap. More...
 
RTEMS_INLINE_ROUTINE Heap_Block_Heap_Free_list_first (Heap_Control *heap)
 Returns the first block of the free list of the heap. More...
 
RTEMS_INLINE_ROUTINE Heap_Block_Heap_Free_list_last (Heap_Control *heap)
 Returns the last block of the free list of the heap. More...
 
RTEMS_INLINE_ROUTINE void _Heap_Free_list_remove (Heap_Block *block)
 Removes the block from the free list. More...
 
RTEMS_INLINE_ROUTINE void _Heap_Free_list_replace (Heap_Block *old_block, Heap_Block *new_block)
 Replaces one block in the free list by another. More...
 
RTEMS_INLINE_ROUTINE void _Heap_Free_list_insert_after (Heap_Block *block_before, Heap_Block *new_block)
 Inserts a block after an existing block in the free list. More...
 
RTEMS_INLINE_ROUTINE void _Heap_Free_list_insert_before (Heap_Block *block_next, Heap_Block *new_block)
 Inserts a block before an existing block in the free list. More...
 
RTEMS_INLINE_ROUTINE bool _Heap_Is_aligned (uintptr_t value, uintptr_t alignment)
 Checks if the value is aligned to the given alignment. More...
 
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Align_down (uintptr_t value, uintptr_t alignment)
 Returns the aligned value, truncating. More...
 
RTEMS_INLINE_ROUTINE Heap_Block_Heap_Block_at (const Heap_Block *block, uintptr_t offset)
 Returns the block which is offset away from block. More...
 
RTEMS_INLINE_ROUTINE Heap_Block_Heap_Prev_block (const Heap_Block *block)
 Returns the address of the previous block. More...
 
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Alloc_area_of_block (const Heap_Block *block)
 Returns the first address in the block without the heap header. More...
 
RTEMS_INLINE_ROUTINE Heap_Block_Heap_Block_of_alloc_area (uintptr_t alloc_begin, uintptr_t page_size)
 Returns the starting address of the block corresponding to the allocatable area. More...
 
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Block_size (const Heap_Block *block)
 Returns the block size. More...
 
RTEMS_INLINE_ROUTINE void _Heap_Block_set_size (Heap_Block *block, uintptr_t size)
 Sets the block size. More...
 
RTEMS_INLINE_ROUTINE bool _Heap_Is_prev_used (const Heap_Block *block)
 Returns if the previous heap block is used. More...
 
RTEMS_INLINE_ROUTINE bool _Heap_Is_used (const Heap_Block *block)
 Returns if the heap block is used. More...
 
RTEMS_INLINE_ROUTINE bool _Heap_Is_free (const Heap_Block *block)
 Returns if the heap block is free. More...
 
RTEMS_INLINE_ROUTINE bool _Heap_Is_block_in_heap (const Heap_Control *heap, const Heap_Block *block)
 Returns if the block is part of the heap. More...
 
RTEMS_INLINE_ROUTINE void _Heap_Set_last_block_size (Heap_Control *heap)
 Sets the size of the last block for the heap. More...
 
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Get_size (const Heap_Control *heap)
 Returns the size of the allocatable area in bytes. More...
 
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Max (uintptr_t a, uintptr_t b)
 Returns the bigger one of the two arguments. More...
 
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Min (uintptr_t a, uintptr_t b)
 Returns the smaller one of the two arguments. More...
 

Detailed Description

Heap Handler Implementation.

Definition in file heapimpl.h.