The code looks fine. It is your understanding of what top reports and the OS is doing that is lacking. I suspect you are on an UNIX system, which means memory is not returned to the OS until the process exits or it needs it for something else and it is recaimed during garbage collection. | | | | | | Roderick (Rod) W. Failing III | | | | | | Engineering Specialist | | | | | | Williams International |__| |__| |__| 2280 West Maple Road ____________ Walled Lake, MI 48390-0200 | | email: [log in to unmask] |____________| Phone: (248) 624-5200 ext. 1930 Fax: (248) 669-5018 -----Original Message----- From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of Daniel Hoult Sent: Friday, November 17, 2006 16:01 To: [log in to unmask] Subject: Deallocating Linked Lists I am not sure where the problem lies, but I am having trouble deallocating memory used by linked lists. To see if I made some sort of error in my code, I simply wrote the following small test program - the same as any other example you can find on the web. The size of and data for the linked list were arbitrary. I am using the 'top' command to check my memory usage - 62 MB. However, even after deallocating the entire list, the memory usage doesn't change. Anyone know what I'm doing wrong? Thanks! program linked implicit none type node integer :: value type(node), pointer :: next end type node integer :: counter type(node), pointer :: list, current nullify(list) do counter = 1, 1000000 allocate(current) current%value = 5 current%next => list list => current end do pause current => list do if (.not. associated(current)) exit list => current%next deallocate(current) current => list end do pause end program linked