<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic yes, this is expected. You in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-Leak/m-p/963227#M16014</link>
    <description>&lt;P&gt;yes, this is expected. You can find the description of MKL Memory Manager from User's Guide:&lt;/P&gt;
&lt;P&gt;Intel MKL Memory Management Software&lt;BR /&gt;Intel MKL has memory management software that controls memory buffers for the use by the library&lt;BR /&gt;functions. New buffers that the library allocates when your application calls Intel MKL are not deallocated&lt;BR /&gt;until the program ends. To get the amount of memory allocated by the memory management software, call&lt;BR /&gt;the mkl_mem_stat() function. If your program needs to free memory, call mkl_free_buffers(). If another&lt;BR /&gt;call is made to a library function that needs a memory buffer, the memory manager again allocates the&lt;BR /&gt;buffers and they again remain allocated until either the program ends or the program deallocates the&lt;BR /&gt;memory. This behavior facilitates better performance. However, some tools may report this behavior as a&lt;BR /&gt;memory leak.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 15 May 2013 16:59:04 GMT</pubDate>
    <dc:creator>Gennady_F_Intel</dc:creator>
    <dc:date>2013-05-15T16:59:04Z</dc:date>
    <item>
      <title>Memory Leak</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-Leak/m-p/963226#M16013</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have an issue with dgemm() and other mkl functions not returning the memory that is used internal to the function.How can I release the memory used up. If this example is ran long enough the application will crash.&lt;/P&gt;
&lt;P&gt;Environment:&lt;/P&gt;
&lt;P&gt;/* MicroSoft Visual C++ 2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Microsoft Windows 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Intel Core i7-2600 CPU 3.40GHz&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;/*&amp;nbsp;&amp;nbsp; Intel(R) C++ Composer XE 2011 Update 9, with Intel(R) C++ Compiler XE 12.1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;/*&amp;nbsp;&amp;nbsp; and Version MKL 10.3 Update 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Sample Code;&lt;/P&gt;
&lt;P&gt;int main(int argc, char* argv[])&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;double *a, *b, *c;&lt;BR /&gt;&amp;nbsp; int n, i;&lt;BR /&gt;&amp;nbsp; double alpha, beta;&lt;BR /&gt;&amp;nbsp; MKL_INT64 AllocatedBytes;&lt;BR /&gt;&amp;nbsp; int N_AllocatedBuffers;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; alpha = 1.1; beta = -1.2;&lt;BR /&gt;&amp;nbsp; n = 1000;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;for(int y=0; y&amp;lt;15; y++)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; a = (double*)mkl_malloc(n*n*sizeof(double),64);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; b = (double*)mkl_malloc(n*n*sizeof(double),64);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; c = (double*)mkl_malloc(n*n*sizeof(double),64);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; for (i=0;i&amp;lt;(n*n);i++) &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; a&lt;I&gt; = (double)(i+1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; b&lt;I&gt; = (double)(-i-1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; dgemm("N","N",&amp;amp;n,&amp;amp;n,&amp;amp;n,&amp;amp;alpha,a,&amp;amp;n,b,&amp;amp;n,&amp;amp;beta,c,&amp;amp;n);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; mkl_free_buffers();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; AllocatedBytes = mkl_mem_stat(&amp;amp;N_AllocatedBuffers);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; printf("\nDGEMM uses "FORMAT" bytes in %d buffers",AllocatedBytes,N_AllocatedBuffers);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; mkl_free(a);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; mkl_free(b);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; mkl_free(c);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; mkl_free_buffers();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; AllocatedBytes = mkl_mem_stat(&amp;amp;N_AllocatedBuffers);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; if (AllocatedBytes &amp;gt; 0) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; printf("\nMKL memory leak!");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; printf("\nAfter mkl_free_buffers there are "FORMAT" bytes in %d buffers",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; AllocatedBytes,N_AllocatedBuffers);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; mkl_free_buffers();&lt;BR /&gt;&amp;nbsp; mkl_thread_free_buffers();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; AllocatedBytes = mkl_mem_stat(&amp;amp;N_AllocatedBuffers);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; if (AllocatedBytes &amp;gt; 0) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; printf("\nMKL memory leak!");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; printf("\nAfter mkl_free_buffers there are "FORMAT" bytes in %d buffers",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; AllocatedBytes,N_AllocatedBuffers);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;CodeOutput:&lt;/P&gt;
&lt;P&gt;Version MKL 10.3 Update 10&lt;BR /&gt;DGEMM uses 24001112 bytes in 8 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 896 bytes in 5 buffe&lt;BR /&gt;DGEMM uses 29278936 bytes in 10 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 5278720 bytes in 7 b&lt;BR /&gt;DGEMM uses 29278936 bytes in 11 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 5278720 bytes in 8 b&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;DGEMM uses 31344728 bytes in 13 buffers&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;BR /&gt;MKL memory leak!&lt;BR /&gt;After mkl_free_buffers there are 7344512 bytes in 10&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Vince&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2013 15:36:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-Leak/m-p/963226#M16013</guid>
      <dc:creator>vincent_ferri</dc:creator>
      <dc:date>2013-05-15T15:36:45Z</dc:date>
    </item>
    <item>
      <title>yes, this is expected. You</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-Leak/m-p/963227#M16014</link>
      <description>&lt;P&gt;yes, this is expected. You can find the description of MKL Memory Manager from User's Guide:&lt;/P&gt;
&lt;P&gt;Intel MKL Memory Management Software&lt;BR /&gt;Intel MKL has memory management software that controls memory buffers for the use by the library&lt;BR /&gt;functions. New buffers that the library allocates when your application calls Intel MKL are not deallocated&lt;BR /&gt;until the program ends. To get the amount of memory allocated by the memory management software, call&lt;BR /&gt;the mkl_mem_stat() function. If your program needs to free memory, call mkl_free_buffers(). If another&lt;BR /&gt;call is made to a library function that needs a memory buffer, the memory manager again allocates the&lt;BR /&gt;buffers and they again remain allocated until either the program ends or the program deallocates the&lt;BR /&gt;memory. This behavior facilitates better performance. However, some tools may report this behavior as a&lt;BR /&gt;memory leak.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2013 16:59:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-Leak/m-p/963227#M16014</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2013-05-15T16:59:04Z</dc:date>
    </item>
    <item>
      <title>By definitrion, a Memory</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-Leak/m-p/963228#M16015</link>
      <description>By definitrion, a Memory Leaks occurs when some memory is completely "lost", Not re-used and another block of memory is allocated instead. If some application or library re-uses the previously allocated memory and releases it when exits then it can Not be considered as a Memory Leaks.</description>
      <pubDate>Fri, 17 May 2013 14:26:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Memory-Leak/m-p/963228#M16015</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-05-17T14:26:57Z</dc:date>
    </item>
  </channel>
</rss>

