<?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 Allocation in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858146#M68158</link>
    <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/336209"&gt;Steve Lionel (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;&lt;BR /&gt;If N is a PARAMETER constant, then this is an ordinary local array that is statically allocated by default. If N is a variable, then it is an automatic array on the stack - it can be placed on the heap by using the /heap-arrays option, though I would recommend making it ALLOCATABLE instead.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;N is declared as a parameter inside a module (Global_var):&lt;BR /&gt;integer, parameter :: N = 10&lt;BR /&gt;&lt;BR /&gt;That's curious then: I was having a stack overflow message (I presented here a small generalization of my original problem) and after some investigation I decided to declare"array" as allocatable and the stack overflow message was gone - the code worked. The /heap-arrays option has always been activated. That is why I was wondering whether array would be allocated to the stack... But your answer confused me.&lt;BR /&gt;&lt;BR /&gt;Does the fact that I have lower and upper bounds in array change anything? Also the kind of array is also defined as an integer parameter inside Global_Data... I would guess not, but just checking.&lt;BR /&gt;&lt;BR /&gt;real(KIND=DOUBLE) array(N1:N2,N3:N4)</description>
    <pubDate>Thu, 17 Dec 2009 18:50:18 GMT</pubDate>
    <dc:creator>rafadix08</dc:creator>
    <dc:date>2009-12-17T18:50:18Z</dc:date>
    <item>
      <title>Memory Allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858144#M68156</link>
      <description>&lt;P&gt;Consider the following array declaration inside a subroutine:&lt;BR /&gt;&lt;BR /&gt;Subroutine my_sub&lt;BR /&gt;&lt;BR /&gt;Use Global_Var&lt;BR /&gt;&lt;BR /&gt;real(8) array(N)&lt;BR /&gt;&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;end subroutine my_subs&lt;BR /&gt;&lt;BR /&gt;N is a parameter defined inside module Global_var&lt;BR /&gt;&lt;BR /&gt;Is array an automatic array and hence allocated to the stack?&lt;BR /&gt;If yes, the only way for it to go to the heap is by making it allocatable? Or is there another way?&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;BR /&gt;Rafael&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2009 18:02:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858144#M68156</guid>
      <dc:creator>rafadix08</dc:creator>
      <dc:date>2009-12-17T18:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858145#M68157</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;If N is a PARAMETER constant, then this is an ordinary local array that is statically allocated by default. If N is a variable, then it is an automatic array on the stack - it can be placed on the heap by using the /heap-arrays option, though I would recommend making it ALLOCATABLE instead.&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Dec 2009 18:34:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858145#M68157</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-12-17T18:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858146#M68158</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/336209"&gt;Steve Lionel (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;&lt;BR /&gt;If N is a PARAMETER constant, then this is an ordinary local array that is statically allocated by default. If N is a variable, then it is an automatic array on the stack - it can be placed on the heap by using the /heap-arrays option, though I would recommend making it ALLOCATABLE instead.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;N is declared as a parameter inside a module (Global_var):&lt;BR /&gt;integer, parameter :: N = 10&lt;BR /&gt;&lt;BR /&gt;That's curious then: I was having a stack overflow message (I presented here a small generalization of my original problem) and after some investigation I decided to declare"array" as allocatable and the stack overflow message was gone - the code worked. The /heap-arrays option has always been activated. That is why I was wondering whether array would be allocated to the stack... But your answer confused me.&lt;BR /&gt;&lt;BR /&gt;Does the fact that I have lower and upper bounds in array change anything? Also the kind of array is also defined as an integer parameter inside Global_Data... I would guess not, but just checking.&lt;BR /&gt;&lt;BR /&gt;real(KIND=DOUBLE) array(N1:N2,N3:N4)</description>
      <pubDate>Thu, 17 Dec 2009 18:50:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858146#M68158</guid>
      <dc:creator>rafadix08</dc:creator>
      <dc:date>2009-12-17T18:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858147#M68159</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
What are your compiler options? The default is that local arrays are statically allocated, but this could change if you added /Qopenmp, /parallel or /recursive.&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Dec 2009 19:03:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858147#M68159</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-12-17T19:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Memory Allocation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858148#M68160</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/336209"&gt;Steve Lionel (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;What are your compiler options? The default is that local arrays are statically allocated, but this could change if you added /Qopenmp, /parallel or /recursive.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Yes, you are right, I added /Qopenmp, that makes local arrays automatic by default. Thank you!</description>
      <pubDate>Thu, 17 Dec 2009 19:12:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Memory-Allocation/m-p/858148#M68160</guid>
      <dc:creator>rafadix08</dc:creator>
      <dc:date>2009-12-17T19:12:10Z</dc:date>
    </item>
  </channel>
</rss>

