Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 415

Stack memory not freed?

$
0
0

Dear all,

according to a little test program (attached) it looks as if the stack memory is not freed after leaving a subroutine. I have had this problem with a much larger code, which after a while died because it was running out of memory. The problem can be solved by adding the compiler flag "-heap-arrays". (This is, however, only a partial solution to the problem because stack memory still seems to get eaten up in all the libraries that I use: MPI, HDF5, FFTW, ScaLAPACK.)

The simple test program calls a subroutine where a temporary array is created and reports the RSS value (function mem_usage) before and after (and also the array size). The output when compiling with "ifort -cpp test.f -o test" is

       872 before sub
 Array size                 31250
     32220 after sub

So, it seems that the stack memory is not freed after leaving the subroutine. Compiling with "ifort -cpp -heap-arrays test.f -o test" gives

       880 before sub
 Array size                 31250
       988 after sub

This looks better. (With "-no-heap-arrays" we get the first output.) Tested versions are 12.1.3 20120212 and 16.0.2 20160204.

The code is attached. I don't know if this is a bug. I submit it as a question.

Thanks in advance!

Christoph

 


Viewing all articles
Browse latest Browse all 415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>