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.
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.
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.