Hi Karl:We use "sync" and "drop_caches" to clean up the old cache.Jean----- Forwarded Message -----
From: jean li <xgeast@xxxxxxxxx>
To: Karl Smith - NOAA Affiliate <karl.smith@xxxxxxxx>
Sent: Tuesday, July 9, 2013 3:11 PM
Subject: Re: [ferret_users] memory usage creeping up
Hi Karl:
Thanks for your quick reply. Sorry that I haven't explained my problem clearly. I don't have any errors related to memory usage.
I think you are right. The problem has something to do with that the Linux cannot delete the cached data in the memory. And we have to use "sync" to free up all the memory. This problem gets so bad that we have to use a crontab script and run this script on a daily basis.
However, I also run other programs on these machines, e.g. matlab and Fortran, which use a lot of memory as well. But I haven't noticed this problem when running Matlab or Fortran. Matlab will crash the system if there is not enough memory.
FYI. Below is my ferret script that causes the memory to creep up.-----------------repeat/range=904:987/name=m (use "/home/liz/Arctic_2012/arctic_ll_`m`.nc";\
save/append/file="/home/liz/Arctic_2012/wind_1996_temp.nc" uwind_ll, vwind_ll;\
save/append/file="/home/liz/Arctic_2012/current_1996_temp.nc" u_ll, v_ll;\
save/append/file="/home/liz/Arctic_2012/ice_1996_temp.nc" uice_ll, vice_ll, aice_ll;\
can data "/home/liz/Arctic_2012/arctic_ll_`m`.nc";\
can data/all;\
can memory)The wind*.nc etc files are at 2-3 GB. Each input file is at 100MB. After I run this script a few times, the memory is all used up.Thanks again for your help.Jean
From: Karl Smith - NOAA Affiliate <karl.smith@xxxxxxxx>
To: jean li <xgeast@xxxxxxxxx>
Cc: "ferret_users@xxxxxxxx" <ferret_users@xxxxxxxx>
Sent: Tuesday, July 9, 2013 1:27 PM
Subject: Re: [ferret_users] memory usage creeping up
Another thing to note with Ferret is the cancel data and cancel memory Ferret commands will not return memory to the operating system (one exception: when using string arrays - see below). Only changing the size given with the set memory Ferret command will do that.Hi Jean,Once Ferret quits, it is not possible for the program to keep memory reserved. You can use the Linux command "ps -fu <username>" (where <username> is you username on the machine) to display all processes you are running if you want to verify Ferret is no longer around. If there is still a ferret process running when you think you have exited all of them, you can use the Linux kill command to kill the runaway process (using the PID given in the ps command).
Linux (like most operating systems) does cache data read from disk, so what you may be noticing is the data from your data sets that you use being held in cache memory. However, if Linux needs more memory for some process, it will delete the oldest cached data and use that memory. So you will never get an out-of-memory error message just because a large amount of your memory happens to be used for caching data. You did not indicate whether you were getting an errors because of the memory usage.
If you are using string arrays, the memory for the strings are allocated separately from system memory, so cancelling string arrays will return memory to the system. But use of string arrays is very rare.Regards,KarlOn Tue, Jul 9, 2013 at 8:35 AM, jean li <xgeast@xxxxxxxxx> wrote:
Hi All:
I find that the memory usage creeping up after using Ferret. Even if I quit Ferret session, the memory couldn't be released. In my ferret code, I use
cancel data and cancel memory but that doesn't seem to help. I could process the data with "set mem/size=1500", but after a few runs, it filled up the memory of a 65G Linux cluster. The same problem occurred on my Linux (Dell) workstation as well. I am using ferret v6.64 on a 64 bit red hat Linux.
Thanks for your help.
Jean
--
Karl M. Smith, Ph.D.
JISAO Univ. Wash. and TMAP/PMEL NOAA
"The contents of this message are mine personally and do
not necessarily reflect any position of the Government
or the National Oceanic and Atmospheric Administration."