<?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 Re: Memory leak: a minimal example in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743350#M178642</link>
    <description>&lt;P&gt;Thank you. Yes, here, after removing the PRINT, I have no more additional memory allocation. It is now +0 in total.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test_leak_revised.png" style="width: 525px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/71983i896109CCF781F1F7/image-dimensions/525x341/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="525" height="341" role="button" title="test_leak_revised.png" alt="test_leak_revised.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Apr 2026 11:43:54 GMT</pubDate>
    <dc:creator>mchoi</dc:creator>
    <dc:date>2026-04-06T11:43:54Z</dc:date>
    <item>
      <title>Memory leak: a minimal example</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743278#M178636</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found that a constantly deallocated memory at the end of the subroutine (or even the program).&amp;nbsp;I am wondering if I made anything wrong here. I suppose that all allocated memories must be deallocated at the end. But the diagnostic tool tells me 'Allocations (diff)' is still +5 at the end. The example code is attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test_leak.png" style="width: 584px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/71977i52B2AD0013BCF017/image-dimensions/584x359/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="584" height="359" role="button" title="test_leak.png" alt="test_leak.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2026 16:17:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743278#M178636</guid>
      <dc:creator>mchoi</dc:creator>
      <dc:date>2026-04-05T16:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak: a minimal example</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743287#M178637</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try: (i) containing the subroutine &lt;STRONG&gt;within&lt;/STRONG&gt; the main program, (ii) using a &lt;STRONG&gt;module&lt;/STRONG&gt;. For example, in the first case,&lt;/P&gt;&lt;P&gt;program leak_test&lt;BR /&gt;&amp;nbsp; &amp;nbsp; implicit none&lt;BR /&gt;&amp;nbsp; &amp;nbsp; double precision, allocatable :: mat(:,:)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; integer :: i&lt;BR /&gt;&amp;nbsp; &amp;nbsp; allocate (mat(100, 100))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; do i = 1, 100000&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; call sub_calc(mat)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (mod(i, 1000) == 0) print *, "iteration: ", i&lt;BR /&gt;&amp;nbsp; &amp;nbsp; end do&lt;BR /&gt;&amp;nbsp; &amp;nbsp; deallocate(mat)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; contains&lt;BR /&gt;&amp;nbsp; &amp;nbsp; subroutine sub_calc(a)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; implicit none&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; double precision :: a(1000, 1000)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a(1,1) = a(1,1) + 1.0d0&lt;BR /&gt;&amp;nbsp; &amp;nbsp; end subroutine sub_calc&lt;BR /&gt;end program leak_test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ ifx --version&lt;BR /&gt;ifx (IFX) 2025.3.3 20260319&lt;BR /&gt;Copyright (C) 1985-2026 Intel Corporation. All rights reserved.&lt;/P&gt;&lt;P&gt;$ ifx -mtune=generic -std18 -WB -warn all -check all -o testcase-0222-ifx.exe testcase-0222.f90&lt;/P&gt;&lt;P&gt;$ testcase-0222-ifx.exe&lt;/P&gt;&lt;P&gt;iteration: 1000&lt;BR /&gt;iteration: 2000&lt;BR /&gt;...&lt;BR /&gt;iteration: 98000&lt;BR /&gt;iteration: 99000&lt;BR /&gt;iteration: 100000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge D'Elia&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/353092"&gt;@mchoi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found that a constantly deallocated memory at the end of the subroutine (or even the program).&amp;nbsp;I am wondering if I made anything wrong here. I suppose that all allocated memories must be deallocated at the end. But the diagnostic tool tells me 'Allocations (diff)' is still +5 at the end. The example code is attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test_leak.png" style="width: 584px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/71977i52B2AD0013BCF017/image-dimensions/584x359/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="584" height="359" role="button" title="test_leak.png" alt="test_leak.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2026 18:38:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743287#M178637</guid>
      <dc:creator>jdelia1</dc:creator>
      <dc:date>2026-04-05T18:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak: a minimal example</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743291#M178638</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try: (i) using a module; (ii) containing the subroutine within the main program. For example, in the second case:&lt;/P&gt;&lt;P&gt;program leak_test&lt;BR /&gt;&amp;nbsp; &amp;nbsp; implicit none&lt;BR /&gt;&amp;nbsp; &amp;nbsp; double precision, allocatable :: mat(:,:)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; integer :: i&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; allocate (mat(100, 100))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; do i = 1, 100000&lt;BR /&gt;&amp;nbsp; &amp;nbsp; call sub_calc(mat)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if (mod(i, 1000) == 0) print *, "iteration: ", i&lt;BR /&gt;&amp;nbsp; &amp;nbsp; end do&lt;BR /&gt;&amp;nbsp; &amp;nbsp; deallocate(mat)&lt;BR /&gt;contains&lt;BR /&gt;&amp;nbsp; &amp;nbsp; subroutine sub_calc(a)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; implicit none&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; double precision :: a(1000, 1000)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a(1,1) = a(1,1) + 1.0d0&lt;BR /&gt;&amp;nbsp; &amp;nbsp; end subroutine sub_calc&lt;BR /&gt;end program leak_test&lt;/P&gt;&lt;P&gt;$ ifx --version&lt;BR /&gt;ifx (IFX) 2025.3.3 20260319&lt;BR /&gt;Copyright (C) 1985-2026 Intel Corporation. All rights reserved.&lt;/P&gt;&lt;P&gt;$ ifx -mtune=generic -std18 -WB -warn all -check all -o testcase-0222-ifx.exe testcase-0222.f90&lt;BR /&gt;$ testcase-0222-ifx.exe&lt;BR /&gt;iteration: 1000&lt;BR /&gt;iteration: 2000&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;iteration: 99000&lt;BR /&gt;iteration: 100000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Jorge.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2026 19:06:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743291#M178638</guid>
      <dc:creator>jdelia1</dc:creator>
      <dc:date>2026-04-05T19:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak: a minimal example</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743299#M178639</link>
      <description>&lt;P&gt;I am not seeing a problem here, and your description seems strange.&lt;/P&gt;&lt;P&gt;The memory you allocate with ALLOCATE is completely deallocated by the DEALLOCATE. There is additional memory that has been allocated for the I/O operations - those are not explicitly deallocated by the program but go away when the process exits.&lt;/P&gt;&lt;P&gt;In the screenshot below, I did a snapshot before and after the ALLOCATE and before and after the DEALLOCATE.&lt;/P&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2026-04-05 182819.png" style="width: 303px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/71982i16899C20287F4318/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2026-04-05 182819.png" alt="Screenshot 2026-04-05 182819.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I then removed the PRINT and saw this:&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2026-04-05 183050.png" style="width: 300px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/71981iA5701C17463A0E51/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2026-04-05 183050.png" alt="Screenshot 2026-04-05 183050.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Looks perfectly normal to me.&lt;/DIV&gt;</description>
      <pubDate>Sun, 05 Apr 2026 22:34:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743299#M178639</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2026-04-05T22:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak: a minimal example</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743350#M178642</link>
      <description>&lt;P&gt;Thank you. Yes, here, after removing the PRINT, I have no more additional memory allocation. It is now +0 in total.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test_leak_revised.png" style="width: 525px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/71983i896109CCF781F1F7/image-dimensions/525x341/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="525" height="341" role="button" title="test_leak_revised.png" alt="test_leak_revised.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2026 11:43:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-leak-a-minimal-example/m-p/1743350#M178642</guid>
      <dc:creator>mchoi</dc:creator>
      <dc:date>2026-04-06T11:43:54Z</dc:date>
    </item>
  </channel>
</rss>

