Help Center/ Atlas 300 Application (Model 3000)/ Tuning Guide/ Key Points/ Memory Management/ Memory Management APIs Provided by the Native Language
Updated on 2022-03-13 GMT+08:00

Memory Management APIs Provided by the Native Language

The native language (C/C++) provides the malloc, free, memcpy, memset, new, and delete APIs for memory management. You can manage and control the lifecycle of memory allocated by using these APIs. If the memory to be allocated is less than 256 KB, memory management APIs provided by the native language and those provided by the Matrix module show similar performance. Therefore, you are advised to use a memory management API provided by the native language to simplify programming.

The following code shows how to use memory management APIs provided by the native language:
// Use malloc to alloc buffer
unsigned char* inbuf = (unsigned char*)malloc( fileLen );
// free buffer
free(inbuf);
inbuf = nullptr;