void ei_free(void *ptr);
Brief: Wrapper around free
Location: edge-impulse-sdk/porting/ei_classifier_porting.h
Blocking: Depends on user implementation
Description:
ei_free()
is declared internally in the Edge Impulse SDK library, and the function must be defined by the user.
This function should free the memory space pointed to by ptr
. If ptr
is NULL
, no operation should be performed. In bare-metal implementations, it can simply be a wrapper for free()
. For example:
__attribute__((weak)) void ei_free(void *ptr) {
free(ptr);
}
If you intend to run your impulse in a multi-threaded environment, you will need to ensure that your implementation of ei_free()
is thread-safe. For example, if you are using FreeRTOS, here is one possible implementation:
__attribute__((weak)) void ei_free(void *ptr) {
pvPortFree(ptr);
}
Parameters:
ptr
- [input] Pointer to the allocated memory.
Example:
The following examples demonstrate possible implementations of this function for various platforms. Note the __attribute__((weak))
in most of the definitions, which means that a user could override the implementation elsewhere in the program: