mac osx (catalina)
gfortran 9.3.0 from homebrew
htop 2.2.0 from homebrew
I have the following program in memtest.f90
which I compile with gfortran memtest.f90 -o test
and then call with ./test
program main
implicit none
integer, parameter :: n=100000000
real, allocatable :: values(:)
print *, "no memory used yet, press enter"
read(*,*)
allocate(values(n))
values = 0.0
print *, "used a lot of memory, press enter"
read(*,*)
deallocate(values)
print *, "why is the memory still there in htop"
read(*,*)
end program main
I am expecting the memory used by the program to drop after calling the deallocate statement, however, as indicated by htop
it continues to hover at about 382 MB (see image below)
is this a memory leak and if so how do I properly release the memory or am I just doing something wrong in looking at the memory consumed by the program?