Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otMalloc.h File Reference

Multi-heap memory management library for otStudio. More...

#include "otdefs.h"

Defines

#define OT_FAST_HEAP1_SIZE   (4U * 1024U)
#define OT_FAST_HEAP2_SIZE   (15U * 1024U)
#define OT_FAST_BANK_NONE   0
#define OT_FAST_BANK_1   1
#define OT_FAST_BANK_2   2

Functions

void _initMalloc ()
 Initialize the historical normal heap. Call once during setup().
U32 _memFree ()
 Return currently allocatable bytes in the normal heap.
void * _malloc (U32 size)
 Allocate memory from the normal heap.
void * _calloc (U32 size)
 Allocate and zero-initialize memory from the normal heap.
void * _realloc (void *ptr, U32 size)
 Reallocate a block from the normal heap.
void * _reallocf (void *ptr, U32 size)
 Reallocate and free the original block on failure.
void _free (void *ptr)
 Free a block allocated by the normal heap.
void _initFastMalloc ()
 Initialize the two built-in fast heaps.
void _initFastMallocRegions (void *bank1Start, U32 bank1Size, void *bank2Start, U32 bank2Size)
 Initialize the fast allocator with caller-supplied regions.
char _fastMallocReady ()
 Return non-zero when at least one fast heap is available.
void * _fastMalloc1 (U32 size)
 Allocate from fast Bank 1 only. Returns null when it does not fit.
void * _fastMalloc2 (U32 size)
 Allocate from fast Bank 2 only. Returns null when it does not fit.
void * _fastMalloc (U32 size)
 Allocate from either fast bank.
void * _fastCalloc1 (U32 size)
 Zero-initialized equivalents of the fast allocation functions.
void * _fastCalloc2 (U32 size)
void * _fastCalloc (U32 size)
void _fastFree (void *ptr)
 Free a block allocated by any fast heap.
U32 _fastMemFree1 ()
 Return free bytes in fast Bank 1 / Bank 2.
U32 _fastMemFree2 ()
U32 _fastMemLargest1 ()
 Return the largest currently allocatable block in each fast bank.
U32 _fastMemLargest2 ()
int _fastMemBank (const void *ptr)
 Identify the fast bank containing ptr.


Detailed Description

Version:
2.0.0
Author:
Manuele Turini
The historical _malloc/_free API is preserved for the normal otStudio heap. Version 2.0 adds two independent optional fast heaps intended for the two Blackfin L1 data banks. Fast allocations are dynamic: applications can use them when performance matters and transparently fall back to the normal heap when capacity is more important. footer
otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0