Monday, April 4, 2011

How to use more than 4 GB of RAM with 32-bit Windows

Until this year, I had only 3GB of RAM in my ThinkPad T61 laptop because the collective wisdom of the internet dictated that my 32-bit Windows XP OS couldn't take advantage of any physical memory beyond 3GB.

For the past 3 years I've also been running this machine without a Windows paging file (no "virtual memory"), which, by the way, is the only performant way to run Windows XP due to its overly-aggressive swapping behavior (but that's a different topic).  The only problem with having only 3 gigs of RAM and no swap file is that when your applications need more than 3 gigs, you're out of luck, and as applications have been getting heavier over the years and programmers have been getting lazy about optimizing their memory profile, 3 gigs wasn't cutting it for me any more. And since I don't like to assume that something can't be done without trying it first, I decided to see what happens if I just go ahead and buy more RAM.

A few months ago, I bought a new 4GB stick, which brought my system up to a total of 6GB of physical RAM.  As I replaced the screws and booted my laptop, I was excited to see the BIOS recognizing all 6 gigs (which wasn't even possible according to the ThinkPad T61 docs).  However, as I opened up Task Manager, my hopes were dashed.  Instead of the prior 2880 MB maximum commit charge I had with 3 gigs, it was now giving me 2900 MB with my 6 gigs.  Awesome - I just paid $70 for an extra 20MB of RAM!  I haven't seen this good a deal since 1997.  I sighed, and started daydreaming about upgrading to Windows 7 64-bit to take advantage of my new RAM - a purchase which would bring the cost of the extra 3 gigs up to $270 (awesome - at least we're up to 2006 in memory costs now).

TL;DR:

I am now using almost all of the physical memory on my 32-bit Windows XP machine.  I did it by installing the free Dataram RAMDisk software.  Dataram lets you create a virtual in-memory disk drive using physical memory beyond 4GB - memory which isn't otherwise usable by Win32!  Allocating a 1.5 GB paging file (a.k.a. "swap file") on the RAMdisk, I now have 4436MB at my disposal!  If I wanted to, I could actually upgrade my RAM to 8GB and be able to use as much as 7 physical gigs without using neither a hard disk drive for swap space nor having to upgrade to a 64 bit operating system.


Conclusion:

I've been using this setup of almost a week.  No crashes so far.  The performance is decent, but unfortunately still not as good as it was without any paging file at all.  Even though task switching with the RAM disk is orders of magnitude faster than using a hard disk drive, I still get the same annoying GUI refresh problems in non-native apps that you get when letting the horrendous Windows XP memory manager get its hands on a paging file.

Caution:

Hibernation will (obviously) not work when you keep the system paging file on a RAMdisk.  Windows will give you the dreaded BSOD when attempting to wake up from hibernation.  That's because hibernation mode relies on all in-memory data being saved to disk, and Windows isn't aware of the need to save the content of the RAMdisk.  So if you're going to be using this hack, it might be a good idea to disable hibernation in your system settings.  Sleep mode still works fine, so the lack of hibernation is only a problem for laptops with a drained battery.

Summary:


I described 3 hacks in this article:
  1. If you have enough RAM for your apps, you can, and should, run Windows XP without a paging file by going to Control Panel > System > Advanced > Performance > Advanced > Virtual Memory > Change, and selecting "No paging file" for all drives.
  2. You can install more than 4GB into a ThinkPad T61 despite what the manual says.
  3. You can use software, such as Dataram RAMDisk, to take advantage of all your physical RAM on a 32-bit Windows system.
Follow me:

For more computer, social, and life hacks, you should follow me on Twitter.

No comments: