Functions | |
| NANOEXT void *POSCALL | nosMemAlloc (UINT_t size) |
| NANOEXT void POSCALL | nosMemFree (void *p) |
| NANOEXT void POSCALL * | nosMemRealloc (void *memblock, UINT_t size) |
| NANOEXT void POSCALL | nosMemSet (void *buf, char val, UINT_t count) |
| NANOEXT void POSCALL | nosMemCopy (void *dst, void *src, UINT_t count) |
The nano layer supplies a set of memory management functions. pico]OS functions are thread save, thus pico]OS can replace the memory allocation functions of a runtime library that was not designed for a multitasking environment.
| NANOEXT void* POSCALL nosMemAlloc | ( | UINT_t | size | ) |
Allocate memory from the heap. This function allocates a block of memory from the heap. The function is thread save, thus multiple threads can access the heap without corrupting it.
| size | in bytes of the memory block to allocate. |
| NANOEXT void POSCALL nosMemCopy | ( | void * | dst, | |
| void * | src, | |||
| UINT_t | count | |||
| ) |
Copy a block of memory. This function works like the memcpy function from the C runtime library.
| dst | pointer to the destination memory block | |
| src | pointer to the source memory block | |
| count | number of bytes to copy |
| NANOEXT void POSCALL nosMemFree | ( | void * | p | ) |
Free a block of memory to the heap. This function is the counterpart to nosMemAlloc.
| p | pointer to the memory block to free. |
| NANOEXT void POSCALL* nosMemRealloc | ( | void * | memblock, | |
| UINT_t | size | |||
| ) |
Reallocate a block of memory. Sometimes it is necessary to increase or decrease the size of a memory block on the heap. This function works like the usual realloc(), it is optimized to keep the heap clean and unfragmented.
| memblock | pointer to the memory block on the heap. | |
| size | new size of the memory block (larger or smaller) |
nosMemRealloc reaches the best performance only when NOSCFG_MEM_MANAGE_MODE is set to 1
| NANOEXT void POSCALL nosMemSet | ( | void * | buf, | |
| char | val, | |||
| UINT_t | count | |||
| ) |
Fill a block of memory with a special character. This function works like the memset function from the C runtime library.
| buf | pointer to the destination memory block | |
| val | character to fill into the memory block | |
| count | number of bytes to fill into the block |
1.5.4