Dear Forum Members,
I am using the Intel Fortran Compiler Version 11.1, the code I am working with uses extensively memory allocation. What I am trying to do is run the code in a loop. Te problem is that this code allocates memory but some of the arrays are not deallocated. It has a fortran STOP in the end which frees the memory, when the code finishes. However if I put a loop around it the code tries to allocate arrays which are already allocated. One can check this issue quite conveniently whith the following command:
If (allocated(array(size))) deallocate (array)
allocate(array)
This is however quite difficult to implement because I have about 800 places where the allocation is done.
In principle if the arrays are allocated inside a subroutine and they are not declared with “SAVE” after the RETURN statement in the end, they are deleted. However there are many places with SAVE statement in my code.
My question is how can I check precisely where this double allocation is taking place. The code tells me just that I have double allocation error, but where exactly and which array is causing the problem is not mentioned. I hope that this can be solved with compiler flags. I have also license for the Visual Fortran compiler, in case necessary I am able to switch to it.
I would appreciate any ideas how to overcome this problem.
Thank you in advance