Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
13 Views

Possible Memory Leak in ifort 2016

Jump to solution

It's related to allocating an allocatable component of a user-defined type array with source or mold option, I'm not sure whether this is a wrong way of using mold/source or is a known issue and will be fixed in 2017 version. Anyway, here is the example:

program main
	implicit none
	type t_test
		real(8), allocatable :: T(:) 
	end type
	real(8) :: B(2)
	type(t_test) :: A(1)

	do
		allocate(A(1)%T,mold=B)
		!allocate(A(1)%T,source=B)
	enddo

end program

and memory leaks!

if change "A(1)" to a scale "A", then allocate statement will raise a "allocatable array is already allocated" error. I'm not sure whether this error is normal or mold/source should reallocate automatically if shape doesn't match?

compiled with Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.3.210 Build 20160415

0 Kudos

Accepted Solutions
Highlighted
13 Views

I expect this to be fixed in Update 2 to Parallel Studio XE 2017.

Retired 12/31/2016

View solution in original post

0 Kudos
2 Replies
Highlighted
13 Views

Thanks - the subsequent ALLOCATEs should cause a run-time error. The standard says, "An allocatable variable with [allocated] status may be referenced, defined, or deallocated; allocating it causes an error condition in the ALLOCATE statement." I'm not sure why that's not happening here and will send this on to the developers. Issue ID is DPD200414580.

From what I can see, if SOURCE= or MOLD= is used, no check for "already allocated" is done, which is incorrect.

Retired 12/31/2016
0 Kudos
Highlighted
14 Views

I expect this to be fixed in Update 2 to Parallel Studio XE 2017.

Retired 12/31/2016

View solution in original post

0 Kudos