Memory leak using LAPACKE_dsygst

Memory leak using LAPACKE_dsygst

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[i], &gmat[addresses[i]], R, &emat[addresses[i]],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....

3 帖子 / 0 全新
Best Reply

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 ""

Thanks for the info Gennady. I had no idea that MKL was doing tricky memory management things; good to know.