Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Ifort: possible memory leak.

arturodigioia
Beginner
431 Views
This sample code shows a memory leak problem I'm having in Ifort.

---------memoryleak.f90------------

program memoryleak

implicit none

integer :: i,j
real(8),dimension(2000) :: a

open(unit=10,form="unformatted",action="write",status="scratch")

pause
do i=1,1000000
a=dble(i)
j=i/100000+1000
write(10) a(1:j)
end do
pause

close(10)

end program memoryleak

------------------------------

Everything works under ifc 7.1, but if I compile it with ifort (l_fc_pc_8.0.046_pe049.1, upgraded this morning) and I run it, it starts eating up memory until it segfaults.
The problem is in the

write(10) a(1:j)

statement. Apparently ifort has problems with the variable range '1:j' of the array 'a' in the write statement. If I specify a fixed range everything works. Can anyone confirm this behaviour before I submit a bug report?
0 Kudos
3 Replies
anupam_mu
Beginner
431 Views
try
ulimit -s unlimited
0 Kudos
Steven_L_Intel1
Employee
431 Views
I don't see evidence of a bug. Rather, ifort 8 uses the stack for array temporaries whereas ifl 7 sometimes used the heap. We recognize that this is not an ideal situation, but it is not a bug. As suggested, raising the stack limit is usually the solution.
0 Kudos
arturodigioia
Beginner
431 Views
I filed an issue on Intel Premier. The latest update (l_fc_pc_8.0.046_pe050.1) fixed the thing (whether it was a bug or not). Now the code executes correctly without having to touch the stack size.
0 Kudos
Reply