Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Pardiso - memory leak?

matse
Beginner
374 Views
Hello,
I have some troubles with Pardiso, it uses my whole memory (8 GB) and swaps data to my HDD. I have tried to use
[cpp]mkl_free_buffers();[/cpp]
with no success. My code now basically looks like this:

[cpp]AllocatedBytes = mkl_mem_stat(&N_AllocatedBuffers);
printf("\nusing %ld bytes in %d buffers\n",(long)AllocatedBytes,N_AllocatedBuffers);

//calling pardiso
pardiso( pt , & maxfct , & mnum , & mtype , & phase , &n , a , ia , ja , perm , & nrhs, iparm , & msglvl , y , sol , & error );

AllocatedBytes = mkl_mem_stat(&N_AllocatedBuffers);
printf("\nusing %ld bytes in %d buffers\n",(long)AllocatedBytes,N_AllocatedBuffers);

mkl_free_buffers();

AllocatedBytes = mkl_mem_stat(&N_AllocatedBuffers);
printf("\nusing %ld bytes in %d buffers\n",(long)AllocatedBytes,N_AllocatedBuffers);[/cpp]

Pardiso solves my problem fine but the output of the program is:

[bash]using 524352 bytes in 1 buffers
.
.//some pardiso output, seems to work fine
.

//before mkl_free_buffers();
using 1428469361 bytes in 126 buffers

//after mkl_free_buffers();
using 1411149489 bytes in 116 buffers
[/bash]
The thing is that I use Pardiso in a loop, so it solves different kind of problems - but after the fifth run I'm out of memory and the swapping begins.
Can anybody help me with that?
Thanks,
matse

//Edit: OK, I just read that setting the Pardiso parameter "phase" to "-1" and calling Pardiso afterwards with this parameter releases the memory, so then it works as expected. But shouldn't mkl_free_buffers() work, too?
0 Kudos
1 Reply
barragan_villanueva_
Valued Contributor I
374 Views
Hi,

MKL function mkl_free_buffers() releases all memory which is taken by MKL memory manager software and already maked as free but can be used in the future. As to PARDISO-memory, it needs explicitly free such memory.
0 Kudos
Reply