Alright, so I'm sure you've all been there. You're running photoshop for hours at a time, watching your pirated pr0n, or perusing myspace for your new piece of ass for the night, and all those graphic-intense programs suck up your ram. Then they don't give it back. So, if you're like me, you restart your computer a hundred times a week, pissing off everyone watching your pirated shit off the network when Debbie Does Dallas suddenly freezes on their computer.
There's a few solutions to this. You could download System Mechanic, or TweakXP and run some of their utilities to "defrag" your RAM. But if you're like me, I don't like a hundred different utilities installed on my shit. The simpler, the better. As long as you have Visual Basic Runtimes installed, which you probably do, you can do this.
Open up notepad. Or Notepad++, which I must say is the best program ever. Motherfuck Microsoft Word. (Get OpenOffice here: [Click, Dick] ).
If you have less than or equal to 128MB of RAM, type this: Mystring = Space(16000000) For more than 128MB of RAM, type this: Mystring = Space(80000000) I even bumped mine up to 160000000 and it worked excellently.
Save your file as "Memory.vbs". Close as many programs as you can, and then run this script. Keep it somewhere handy. I like to keep mine in the QuickLaunch toolbar.
All this does is allocate a chunk of memory while the script is running, and then the VB runtimes deallocate it. The Value needs to be set according to the amount of memory you have (i.e. it will probably need increasing in order to be effective if you have 1Gb), but forces any currently unused memory to be paged to the swapfile, thus freeing that memory in order to be used by the rest of the system. i.e. if you are working on a large image file in PSP and then minimize PSP, you can temporarily regain physical memory by swapping currently unused ram out to the pagefile. This is what almost all memory optimiser programs do AFAIK (including stuff like TweakXP Pro etc.).
By using this method of defragmentation, any memory leaks can be paged out to your swapfile, thus freeing physical memory (since memory leaks will never be accessed again).
Additionally, this will reduce the (admittedly very small) overhead of trying to allocate memory blocks, as it is quicker to allocate a contiguous block than several uncontiguous blocks.
I must say it's also a good idea to clear your page file after every windows shutdown. Not that it NEEDS to be done, but... I'd do it. Keep your shit clean. A computer is a machine and well-maintained machines always run better than unmaintained ones. It also prevents small security leaks associated with your swap file, since your Virtual Memory tends to store certain unencrypted data like passwords.
To do this, you need to open your registry editor. (If you don't know how to do this already, you dont need to go any further.)
Navigate to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Then, on the right hand side, locate the ClearPageFileAtShutdown value. Right-click the value, select modify, and change the data value of the registry key to 1.
If the ClearPageFileAtShutdown value doesn't exist, add it. Right-click the right side of your specified key and add it as a DWORD value. Then change the data value to 1.
Restart your computer for changes to take effect. (Note: Your computer shut down time my increase slightly).
Hope you all got something out of this post! Any questions or comments, let me know. Like I said... beats the hell outta restarting every time you max out your memory. Small alternative (and I must say, much safer alternative) for Windows to the Unix dump memory command. Enjoy!