RTEMS CPU Kit with SuperCore  4.10.99.0
Data Structures | Defines | Typedefs | Enumerations | Functions
rtems/score/heap.h File Reference

Heap Handler API. More...

#include <rtems/system.h>
#include <rtems/score/thread.h>
#include <rtems/score/heap.inl>
Include dependency graph for heap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Heap_Block
 Description for free or used blocks. More...
struct  Heap_Statistics
 Run-time heap statistics. More...
struct  Heap_Control
 Control block used to manage a heap. More...
struct  Heap_Information
 Information about blocks. More...
struct  Heap_Information_block
 Information block returned by _Heap_Get_information(). More...
struct  Heap_Area
 Heap area structure for table based heap initialization and extension. More...

Defines

#define HEAP_PROTECTION_HEADER_SIZE   0
#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_BLOCK_HEADER_SIZE   (2 * sizeof(uintptr_t) + HEAP_PROTECTION_HEADER_SIZE)
 The block header consists of the two size fields (Heap_Block::prev_size and Heap_Block::size_and_flag).
#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)   ((void) 0)
#define _HAssert(cond)   ((void) 0)

Typedefs

typedef struct Heap_Control Heap_Control
typedef struct Heap_Block Heap_Block
typedef uintptr_t(* Heap_Initialization_or_extend_handler )(Heap_Control *heap, void *area_begin, uintptr_t area_size, uintptr_t page_size_or_unused)
 Heap initialization and extend handler type.
typedef bool(* Heap_Block_visitor )(const Heap_Block *block, uintptr_t block_size, bool block_is_used, void *visitor_arg)
 Heap block visitor.

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 with begin heap_area_begin and size heap_area_size.
uintptr_t _Heap_Initialize (Heap_Control *heap, void *area_begin, uintptr_t area_size, uintptr_t page_size)
 Initializes the heap control block heap to manage the area starting at area_begin of size area_size bytes.
uintptr_t _Heap_Extend (Heap_Control *heap, void *area_begin, uintptr_t area_size, uintptr_t unused)
 Extends the memory available for the heap heap using the memory area starting at area_begin of size area_size bytes.
uintptr_t _Heap_No_extend (Heap_Control *unused_0, void *unused_1, uintptr_t unused_2, uintptr_t unused_3)
 This function returns always zero.
void * _Heap_Allocate_aligned_with_boundary (Heap_Control *heap, uintptr_t size, uintptr_t alignment, uintptr_t boundary)
 Allocates a memory area of size size bytes from the heap heap.
RTEMS_INLINE_ROUTINE void * _Heap_Allocate_aligned (Heap_Control *heap, uintptr_t size, uintptr_t alignment)
 See _Heap_Allocate_aligned_with_boundary() with boundary equals zero.
RTEMS_INLINE_ROUTINE void * _Heap_Allocate (Heap_Control *heap, uintptr_t size)
 See _Heap_Allocate_aligned_with_boundary() with alignment and boundary equals zero.
bool _Heap_Free (Heap_Control *heap, void *addr)
 Frees the allocated memory area starting at addr in the heap heap.
bool _Heap_Walk (Heap_Control *heap, int source, bool dump)
 Walks the heap heap to verify its integrity.
void _Heap_Iterate (Heap_Control *heap, Heap_Block_visitor visitor, void *visitor_arg)
 Iterates over all blocks of the heap.
Heap_Block_Heap_Greedy_allocate (Heap_Control *heap, const uintptr_t *block_sizes, size_t block_count)
 Greedy allocate that empties the heap.
void _Heap_Greedy_free (Heap_Control *heap, Heap_Block *blocks)
 Frees blocks of a greedy allocation.
void _Heap_Get_information (Heap_Control *heap, Heap_Information_block *info)
 Returns information about used and free blocks for the heap heap in info.
void _Heap_Get_free_information (Heap_Control *heap, Heap_Information *info)
 Returns information about free blocks for the heap heap in info.
bool _Heap_Size_of_alloc_area (Heap_Control *heap, void *addr, uintptr_t *size)
 Returns the size of the allocatable memory area starting at addr in size.
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 starting at addr.
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Align_up (uintptr_t value, uintptr_t alignment)
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Area_overhead (uintptr_t page_size)
 Returns the worst case overhead to manage a memory area.
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.

Detailed Description

Heap Handler API.