Nut/OS  4.10.3
API Reference
heap.c File Reference
#include <cfg/os.h>
#include <sys/heap.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
Include dependency graph for heap.c:

Go to the source code of this file.

Defines

#define NUTMEM_GUARD_BYTES   0
#define NUT_HEAP_OVERHEAD   (sizeof(HEAPNODE) - sizeof(HEAPNODE *))
 Number of bytes used for management information.
#define NUTMEM_HEAPNODE_MIN   (sizeof(HEAPNODE) + (2 * NUTMEM_GUARD_BYTES))
 Minimum size of a node.

Functions

void * NutHeapRootAlloc (HEAPNODE **root, size_t size)
 Allocate a block from heap memory.
void * NutHeapRootAllocClear (HEAPNODE **root, size_t size)
 Allocate an initialized block from heap memory.
int NutHeapRootFree (HEAPNODE **root, void *block)
 Return a block to heap memory.
void NutHeapRootAdd (HEAPNODE **root, void *addr, size_t size)
 Add a new memory region to the heap.
size_t NutHeapRootAvailable (HEAPNODE **root)
 Return the total number of bytes available.
size_t NutHeapRootRegionAvailable (HEAPNODE **root)
 Return the size of the largest block available.
void * NutHeapRootRealloc (HEAPNODE **root, void *block, size_t size)
 Change the size of an allocated memory block.
int NutHeapCheck (void)
 Check consistency of heap.
void NutHeapDump (void *stream)
 Dump heap memory to a given stream.

Variables

HEAPNODEheapFreeList
 List of free nodes in normal memory.