Nut/OS  4.10.3
API Reference
heap.h File Reference

Heap management definitions. More...

#include <cfg/memory.h>
#include <sys/types.h>
Include dependency graph for heap.h:

Go to the source code of this file.

Data Structures

struct  _HEAPNODE
 Heap memory node information structure. More...


#define NutHeapAdd(a, s)   NutHeapRootAdd(&heapFreeList, a, s)
#define NutHeapAvailable()   NutHeapRootAvailable(&heapFreeList)
#define NutHeapRegionAvailable()   NutHeapRootRegionAvailable(&heapFreeList)
#define NutHeapAlloc(s)   NutHeapRootAlloc(&heapFreeList, s)
#define NutHeapAllocClear(s)   NutHeapRootAllocClear(&heapFreeList, s)
#define NutHeapFree(p)   NutHeapRootFree(&heapFreeList, p)
#define NutHeapRealloc(p, s)   NutHeapRootRealloc(&heapFreeList, p, s)
#define NutStackAlloc(s)   NutHeapAlloc(s)
#define NutStackFree(p)   NutHeapFree(p)


typedef struct _HEAPNODE HEAPNODE
 Heap memory node type.


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 * 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 * 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.


 List of free nodes in normal memory.

Detailed Description

Heap management definitions.

Definition in file heap.h.

Define Documentation

#define NutHeapAdd (   a,
)    NutHeapRootAdd(&heapFreeList, a, s)

Definition at line 76 of file heap.h.

Referenced by NutInit().

#define NutHeapRegionAvailable ( )    NutHeapRootRegionAvailable(&heapFreeList)

Definition at line 78 of file heap.h.

#define NutHeapAllocClear (   s)    NutHeapRootAllocClear(&heapFreeList, s)

Definition at line 87 of file heap.h.

Referenced by NutMsgQCreate(), NutNetBufAlloc(), and NutNetBufClonePart().

#define NutHeapRealloc (   p,
)    NutHeapRootRealloc(&heapFreeList, p, s)

Definition at line 89 of file heap.h.

Referenced by realloc().

#define NutStackAlloc (   s)    NutHeapAlloc(s)

Definition at line 102 of file heap.h.

Referenced by NutThreadCreate().

#define NutStackFree (   p)    NutHeapFree(p)

Definition at line 103 of file heap.h.

Referenced by NutThreadDestroy().

Typedef Documentation

Heap memory node type.

Definition at line 56 of file heap.h.