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

Memory leak using LAPACKE_dsygst

bradramshaw
Beginner
297 Views

I have a generalized eigenvalue problem, and I am calling LAPACKE_dsygst eight times, once on each block, of my block-diagonal matrix.  I seem to have a memory leak: I am calling 

_CrtMemCheckpoint( &s1 );

ch = LAPACKE_dsygst(LAPACK_ROW_MAJOR, 1,'U', _basisPop, &gmat[addresses], R, &emat[addresses],R);

_CrtMemCheckpoint( &s2 ); 
if ( _CrtMemDifference( &s3, &s1, &s2) )
_CrtMemDumpStatistics( &s3 );

The _CrtMemCheckpoint checks the state of the heap, and _CrtMemDumpStatistics returns the difference between the two states. As far as I know, LAPACKE_dsygst shouldn't be permanently allocating any memory, but I get a finite memory difference of 1141840 bytes (for an 858 by 858 matrix of doubles) after the first call. What is really puzzling is that I am calling this eight times, once on each block, but I only get the memory difference on the first call on the first block: the other seven times there is no memory difference before and after.

Ideas? I'm not a real programmer, i'm a physicist, so i really don't know what I'm doing here....

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
297 Views
so this is the results of MKL's memory management software works. Here is the quote from the user's guide: "Intel MKL has memory management software that controls memory buffers for the use by the library functions. New buffers that the library allocates when your application calls Intel MKL are not deallocated until the program ends. ..." see the online link of mkl's userguie here "http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_userguide_win/index.htm"

View solution in original post

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
298 Views
so this is the results of MKL's memory management software works. Here is the quote from the user's guide: "Intel MKL has memory management software that controls memory buffers for the use by the library functions. New buffers that the library allocates when your application calls Intel MKL are not deallocated until the program ends. ..." see the online link of mkl's userguie here "http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_userguide_win/index.htm"
0 Kudos
bradramshaw
Beginner
297 Views
Thanks for the info Gennady. I had no idea that MKL was doing tricky memory management things; good to know.
0 Kudos
Reply