Redefining Memory Functions
How to Redefine Memory Functions
- Include thei_malloc.hheader file in your code. This header file contains all declarations required for replacing the memory allocation functions. The header file also describes how memory allocation can be replaced in those Intel libraries that support this feature.
- Redefine values of pointersi_malloc, i_free, i_calloc, andi_reallocprior to the first call tofunctions, as shown in the following example:Intel® oneAPI Math Kernel Library
#include "i_malloc.h" . . . i_malloc = my_malloc; i_calloc = my_calloc; i_realloc = my_realloc; i_free = my_free; . . . // Now you may call Intel MKL functions