Heap_Block_struct Struct Reference
[Heap Handler]

#include <heap.h>

Collaboration diagram for Heap_Block_struct:

Collaboration graph
[legend]

Data Fields

uint32_t prev_size
uint32_t size
Heap_Blocknext
Heap_Blockprev

Detailed Description

The following defines the data structure used to manage individual blocks in a heap. When the block is allocated, the 'next' and 'prev' fields, as well as 'prev_size' field of the next block, are not used by the heap manager and thus the address returned for the block starts at the address of the 'next' field and the size of the user accessible area includes the size of the 'prev_size' field.

Note:
The 'next' and 'prev' pointers are only valid when the block is free. Caution must be taken to ensure that every block is large enough to hold them and that they are not accessed while the block is actually allocated (i.e., not free).

The 'prev_size' field is only valid when HEAP_PREV_USED bit is clear in the 'size' field indicating that previous block is not allocated. If the bit is set, the 'prev_size' field is part of user-accessible space of the previous allocated block and thus shouldn't be accessed by the heap manager code. This trick allows to further decrease overhead in the used blocks to the size of 'size' field (4 bytes).


Field Documentation

size of prev block (if prev block is free)

size of block in bytes and status of prev block

Referenced by _Heap_Block_size(), and _Heap_Is_prev_used().

pointer to the next free block

Referenced by _Heap_Block_insert_after(), _Heap_Block_remove(), _Heap_Block_replace(), and _Heap_First().

pointer to the previous free block

Referenced by _Heap_Block_insert_after(), _Heap_Block_remove(), _Heap_Block_replace(), and _Heap_Last().


The documentation for this struct was generated from the following file:

Generated on Mon Sep 8 06:16:45 2008 for RTEMSSuperCore by  doxygen 1.5.6