Fortran memory leaks
887279Sep 9 2011 — edited Sep 11 2011I'm trying to determine whether we have any memory leaks in our Fortran 95 program using check -leaks. We use several allocate and deallocate statements and using the showleaks command in dbx does show a memory leak, but nothing seems to change whether deallocate is used or not. Does check -leaks work correctly for Fortran memory leaks? We're using deallocate(obj.array) where the array is allocatable and obj is nullified after deallocating. Removing the deallocate statement doesn't increase the number of leaks reported.
Also, I'd like to clarify when Fortran memory leaks are possible. It is my understanding that local allocatable arrays (when not saved) are automatically deallocated when they go out of scope. Is this true? Do I only need to worry about memory leaks from global variables (i.e., declared in modules)?