PDA

View Full Version : memory leak issue


souda
01-06-2004, 09:59 PM
I'm using the allocatable arrays in my Fortran 90 code. In each subroutine the arrays are allocated and then deallocated at the end. The code compiled with Lahey Fortran lf95 runs O.K. and there is no memory leaks or any other problems. But when I compile it with other compilers (pgf90 or Intel) I encounter a memory leak (it runs O.K. but the memory keeps expanding until the process gets killed by the system (Linux RedHat)).

Has anybody ever experienced something similar? And what might be the potential sources of memory leaks (I'm pretty sure I deallocate all the allocated arrays before exiting a subroutine)? Could it be related to the size of the physical memory? Any suggestions/comments would be greatly appreciated.

Alex

tzeis
01-06-2004, 11:42 PM
You might check to see if the other compilers have a compile option to deallocate arrays similar to our --dal option. If you are doing all your deallocations correctly, the behavior should be the same with --dal or --ndal. If your program expands when you specify --ndal, you might have a deallocation problem.
I have found that a utility called MPATROL can be helpful when tracking deallocations. It logs calls to the malloc procedure used by the lf95 runtime. You can inspect the log and compare allocation and deallocation activity.