Avoiding Memory Leaks in oneMKL
When running, Intel® oneAPI Math Kernel Library (oneMKL) may allocate and deallocate internal buffers to facilitate better performance. Memory leaks can occur if the Intel® oneAPI Math Kernel Library is unloaded before freeing the internal buffers.
You can free the internal buffers by calling the mkl_free_buffers() function or, for more granular control, the mkl_thread_free_buffers() function.
Alternatively, setting the MKL_DISABLE_FAST_MM environment variable to 1 or calling the mkl_disable_fast_mm() function disables the internal memory manager. Be aware that this change may negatively impact the performance of some oneMKL functions, especially for small problem sizes.