From: Robert Klemme Date: 2007-10-11T22:38:49+09:00 Subject: Re: Should *most* memory be release back to the system? 2007/10/11, Blackie : > I do appreciate your help (and no that link is lost to the mists of > time as far as I can google.) :) > > I do understand that they are not useful for leak detection, but this > is just observing the peak during the life of the script. During > "other_task" I can see the usage rise *and fall* so I know the OS is > reclaiming *some* memory in places...but the part I don't understand > is why it isn't returning to "tasks" original base of 50M when only > "task" is running. > > I hate to sound dense, but I need to convince some fairly hard-headed > sysadmins. :-) There are a few things to say to this. First, it seems reasonable to hold on to memory that has once been grabbed because you can expect that your process needs that memory again. There is no point in allocating and deallocation memory from the OS all the time. Then, even though memory is allocated does not mean that physical memory is actually used. IIRC pure allocation just reserves memory, only when you try to access it the first time the OS generates a page fault and you get physical memory. If memory is unused for a while chances are that it's paged out to disk *if* other processes need resources. If not, there is no problem anyway. Granted, if a machine does not have enough virtual memory configured this can lead to problems for long running programs but then I'd say the machine is probably misconfigured anyway. Now, what was the third point I had in mind? Ah yes: I believe typically JVM's behave the same. However, Sun's JVM also does heave copying around which might help the OS because objects will be packed on fewer memory pages so that more pages are idle and can be swapped out. I believe the current Ruby interpreter does not copy objects but you can verify this by looking at the source code. All in all, this is a strange reason to ban a programming language from a machine IMHO. Other reasons seem more reasonable to me (management overhead for keeping the installation up to date etc.). Kind regards robert