I have heard from many people that this code would free up RAM when PC becomes sluggish:- FreeMem=Space(64000000) (saving it as .vbs) How its possible ? I think this code will just allocate 64 MB to FreeMem variable. So more 64 MB more will be occupied. Please explain.
Hey there, Well, it's possible if you're REALLY low on RAM, what can happen is it uses up that memory, pushing other things that were using that memory into the pagefile. The page file is really slow though so it isn't really 'free' memory, it's 'free' at the cost of one of your programs running like a slug afterwards. Thanks Francisco
Yes, it is possible. But it is also a trick. The operating system is responsible for administering memory. Applications ask for memory when needed, and then release the ram they were given when no longer needed. In turn the operating system caches returned memory just in case the same applications needs it again. Cached memory doesn't count as free memory. But, if a new application ask for all RAM left, the operating system will give the cached RAM too. This script asks for memory, releases it and quits. Moving a certain amount of RAM from the cache to the free memory pool. You gain nothing and, if an already running application needs memory again there will be an extra cost for administering RAM. If you are running low of memory, things get worst as Francisco said before. Take a look: sauron:~# free total used free shared buffers cached Mem: 483048 479400 3648 0 3696 215776 -/+ buffers/cache: 259928 223120 Swap: 1445808 29904 1415904 Code (markup): There is a total of 483MB of physical RAM, 479MB used, 4MB free and 215MB cached. A new process can take up to 219MB before system starts swapping. REALLY FREE RAM = FREE RAM + CACHED RAM