Tweaking your System Memory
Last Updated on September 26, 2000 by Thomas McGuire

The more RAM you have the better, although with today's memory prices you might want to optimize your current memory system instead. Most users should have at least 64MB RAM to get decent performance in Programs, Games, etc. 128MB is just about as much as you need to go for most PC’s, depending on how you use it. Multimedia users would benefit from having more, as would some power users.

If you have below 64MB RAM or less then you really should buy more RAM. This would be of far greater benefit to you than anything else. Check out our EMS HSDRAM review if you’re looking for some good quality & performing RAM.

The following guide is intended for Windows 9x & Millennium Edition.

What is Virtual memory?

Windows uses a dynamic virtual memory manager to handle Swapfile duties.

In order to provide more memory to applications than is physically present in the computer in the form of RAM, Windows uses hard disk space to simulate RAM. The amount of RAM in the computer plus the size of the Swapfile equals the total physical memory, or virtual memory, size. Windows uses a dynamic Swapfile that remains at a size of 0K until it is needed. The Swapfile can grow to use all the available space on the hard disk if it is necessary. This is the default setting for the paging file. You should use this setting if possible. This is what Microsoft has to say about Virtual memory.

However, it is more efficient to set this yourself rather than let Windows dynamically manage it.

Update

While you would think that updating your systems components is a weird to have mentioned in a memory guide – it’s not. This will generally ensure you have better-optimized components/files & bug fixes; many bug fixes include fixing memory leaks. I suggest using a combination of Windowsupdate, Updates & CNET Catchup (My personal favourite). This way you're bound to find any updateable components.

DMA

BE sure to enable DMA/UDMA support on your hard drives. Right click on My Computer, select Properties. Select the Device Manager tab. Open Disk Drives, then you particular Hard Drive(s). Select the Settings tab.

Tick the DMA box to enable DMA support. By default this will be enabled in Windows 98/Millennium if available. In the BIOS you should also ensure you have your hard drive setup correctly to use the fastest transfer mode that’s supported on the hard drive. Check the BIOS tweak guide for more information. Click Ok & reboot your system for the changes to take effect.

PIO mode data transfer rates are slower than DMA/UDMA transfer rates & the Swapfile benefits from a faster data transfer rate, assuming the hard drive support it. Remember the Swapfile is located on your hard drive too; the faster the data transfer rates are, the faster your Swapfile is.

Hard drive setup

As you may know, the Swapfile exists on your hard drive, which is much slower than using RAM. So speeding up your hard drive can improve Swapfile performance a lot. Although more RAM is highly recommended, having a faster hard drive will suffice. First off run Scandisk to fix any errors on the hard drive.

System Properties contains some important settings which can be used to improve hard drive performance, or simply for troubleshooting purposes.

Right click on My Computer, select Properties. Select the Performance tab. Now hit the File system button. Go to the Troubleshooting tab. Some of these definitions were obtained via the MS Knowledge Base, although only the important ones are covered here.

Disable new file sharing & locking semantics. This setting controls file-locking mechanisms in Windows. Tick (Disabled) this setting if you are currently experiencing problems with some programs, although this should be seen as a last resort, your system will perform optimally with this setting Unticked (Enabled).

Disable synchronous buffer commits. This setting manages the function calls to the File-Commit API to return immediately without checking to see if the data was correctly written to the drive. By default, Windows uses synchronous buffer commits. You can change this setting to enable asynchronous buffer commits for programs that may need this functionality.

Disable write-behind caching for all drives. When enabled (Unticked), your computer sends an enable-write-cache command to the hard disk activating the hard disk write-back cache, & if you disable (Tick) this feature, the hard disk write-back cache is deactivated. When enabled disk I/O performance may improve, although if you experience system failure e.g. Power loss, you could experience drive/file corruption. I'd recommend leaving this Unticked unless your system is prone to bad shutdowns/power failure.

Disable System Restore (Windows Millennium only). Ticking this setting will semi-disable Windows Millennium’s system restore capability. I say semi as it still replaces/rebuilds some files, e.g. autoexec.bat. Although the benefit of Ticking this setting is that it will lessen the amount of hard drive accessing caused by System Restore. Leave this setting Unticked to fully-enable System Restore features. This may reduce system performance slightly as a result of the extra hard drive usage.

RAM tweaks

Seeing as RAM is a lot better performing than the Swapfile, it can help a great deal to optimize your memory settings. Restart your PC & enter the BIOS. The following settings, generally contained in the Advanced chipset features/Chip configuration section, can greatly improve memory performance &/or stability.

Bank 0/1, 2/3, 4/5 DRAM timing. Use this to set the DRAM memory module timing. Most BIOS’ default to 10ns. Other options available may be (depending on BIOS) 8ns, Normal, Medium, Fast, Turbo. Selecting a different setting may improve RAM performance, but reduce stability. Turbo is the fastest setting; 10ns is the slowest (& most stable).

DRAM Clock. With the VIA Apollo 133 based motherboards you have the option to change SDRAM speed. Settings available are Host CLK or +/-33. Host CLK allows the SDRAM to run at the same speed as the Ext. Clock (FSB). You can use the +/-33 in case you want to run the RAM slower/faster than the Ext. Clock, e.g. If you Ext. Clock is 100Mhz you could use +33 to allow your SDRAM to run at 133Mhz. Which is a great option for those of you with PC 133 SDRAM. Or alternatively you could run at a 133Mhz Ext. Clock while your RAM runs at 100Mhz by using the -33 setting. Or you could run PC133 RAM at 133Mhz on a 133Mhz Ext. Clock (aka FSB) by using the Host CLK option. As you can see this option allows for a great deal of possibilities.

Delay DRAM read latch. The lower the value for this the better the memory performance, although stability may be affected. Higher values may improve system stability at the cost of performance.

DRAM speculative leadoff. Enable this for better performance, althought it could make your system less stable, disable it if it does.

Memory Hole At 15M-16M. Some old add-in cards need this enabled to work properly. If you have such a card then enable this, otherwise disable it.

Memory parity/ECC check/DRAM Data Integrity Mode. In the unlikely event you have ECC (Error Correcting Code) memory installed then you should set this to ECC, otherwise set it to non-ECC. Most memory is non-ECC & not really recommended for most users unless the need the added stability (but it is slower when ECC is being used).

RAS active time. A high number will increase performance of the system's SDRAM. Decrease this if stability is affected.

RAS to CAS delay. This should be set to a low number, although it is affected by the quality of you RAM, so set it higher if you have any difficulties afterwards.

Read around write. This is a DRAM optimization feature. If a memory read is addressed to a location whose latest write is being held in a buffer before being written to memory, the read is satisfied through the buffer contents, & the read is not sent to the DRAM. Set this to Enabled for better memory performance.

SDRAM Bank Interleave. For best memory performance set this to 4-bank/way, although lower settings may help improve stability.

SDRAM CAS Latency Time/SDRAM cycle length. This sets the CAS latency timing of the DRAM system memory access cycle when SDRAM system memory is installed. Setting this to 2 will yield better performance, although may be less stable if your SDRAM is not CAS2 rated. 3 is slower & should be used when SDRAM isn't CAS2 rated or you want to improve stability. NOTE - CAS2 can significantly improve performance in many ways.

SDRAM Precharge control. When Enabled, all CPU cycles to SDRAM result in an All Banks Precharge Command on the SDRAM interface. Setting this to Enabled should improve RAM performance. NOTE - When overclocking, particularly when you have an AGP graphics card that’s running at non-spec AGP bus speeds Disabling this may improve stability.

Once you have finished tweaking these setting re-load Windows. Now to optimize the Swapfile settings.

Windows 98/Millennium users

Before you begin doing anything else you'll want to edit your system.ini (Click on Start, Run type in system.ini & hit Enter). Under the [386Enh] heading Add the line ConservativeSwapfileUsage=1 (Make sure to leave a blank line between this & the next heading). This can significantly reduce Virtual memory use as it makes Windows use RAM before the Swapfile. This is particularly beneficial for those with 128MB RAM or more. Save the changes & reboot your system for the change to take effect.

Calculating Virtual memory

Before you can set your Virtual memory you’ll want to get an idea of what to actually set it too. Some recommend using a general formula, e.g. Physical RAM*2.5. This is incorrect however. Using that formula, a person with 16MB RAM should set 40MB, while a person with 128MB RAM should set 320MB. Clearly the person with little RAM needs a greater amount of Virtual memory than the person with a lot of RAM.

To begin with, let Windows manage your virtual memory settings. Then install System monitor. Click on Start, Settings, Control panel, Add/Remove programs. Select the Windows setup tab & then System tools. Select System monitor & install it.

Reboot your system for the changes to take effect.

Open up System monitor (Click on Start, Programs, Accessories, System Tools, System Monitor), select Edit then Add item. Add Swapfile size as shown below. These are the items that System monitor will now track for you. You can remove/add other items by clicking on Edit then Add/Remove item.

Over the next few days load up System monitor & let it track your Swapfile size. Click on Options then Chart & set the update interval as you see fit I’d recommend setting it to 30 seconds or 1 minute, depending on how long you intend to be monitoring for. Make sure to Start logging (Click on File then Start logging) & save the logs so that you’ll be able to reference usage over the days.

It would be best to start tracking your usage when you go to play a game or something that will put your PC under a bit of stress. Run a few time-demos or play Unreal tournament against some bots. This will give you an idea of your Virtual memory needs, however don’t go overboard with the testing you want to track normal usage, not excessive usage. The results are displayed as shown below.

The graph to be concerned with is the Swapfile size. Once you’re satisfied with your monitor it’s time to consult your log. Open the sysmon.log (or whatever you saved it as) with Notepad. You’ll be greeted with something like this.

Unfortunately the size is saved in byte size, rather than in MB’s. To convert into MB’s, take the largest value from the log & divide it by 1048576 (1024*1024). So in the above example it would be 113246208/1048576=110MB (108 rounded up). Obviously you should only be concerned with calculating the highest value, rounding up to the nearest 10 MB’S, e.g. if you get 143.8MB round it up to 150MB.

Setting Virtual memory

Based on your results, there are 2 different methods that should be considered when setting the Virtual memory. 1 is to create a permanent fixed Swapfile; the other is to create a semi-permanent one. The benefit of a Semi-permanent one is that if needed, Windows can enlarge the size of it. This will remove any chance of Out of memory errors occurring. Afterwards Windows will bring the Swapfile back to its original, Minimum size.

If you want to go the Permanent route then set the size about 30-50MB’s larger than the value you’ve calculated, E.g. given the values calculated earlier you’d set both the Minimum & Maximum to 150MB. This will allow for most unforeseen circumstances where extra Virtual memory is needed. Given the large size of hard drives today you should have no problem allowing for the extra space needed for this.

Once you’ve decided on which method you want to choose, take the following steps. NOTE – Some recommend disabling Virtual memory first. Rebooting, then defragmenting the hard drive. Then setting the Virtual memory options. I do not recommend this as it won’t help you much in the sense that it won’t do anything that defragmenting with the Swapfile enabled won’t do (Unless you have a defragmenter that can move the swap file to the outer edge of the hard drive that is).

1.       Right click on My computer & select Properties. Select the Performance tab.

2.       Select Virtual memory. Choose Let me specify my own virtual memory setting. Select step A or B depending on which path you choose to take.

A.      If you’ve chosen to use a Permanent fixed Swapfile set it as shown below (substituting in your own values of course). The values shown below are those I would use.

B.       If you’ve chosen to use a Semi-Permanent Swapfile set it as shown below (substituting in your own values of course). For the Maximum value however set it to whatever amount of hard disk you have free. The values shown below are those I use.

3.       Reboot your PC for the changes to take effect.

Optional - You can also set Virtual memory via the system.ini. Click on Start, Run. Type in system.ini & hit Enter.

Scroll down to the [386Enh] section & add/edit the following lines. The numeric values (where appropriate) to be entered in are in KB’s so to calculate the value, use MB*1024 or Bytes/1024 as the numeric value to enter in.

Setting Virtual memory (Continued)

PagingDrive=x:. Replace x with the appropriate drive letter where you want your Swapfile located. E.g. If you want to locate your Swapfile on the D:\ drive then I would enter in PagingDrive=D:.

PagingFile=x:\name. As above, replace x with the appropriate drive letter where you want your Swapfile located (Obviously you need to set it to the same drive as where the PagingDrive is set to). Replace name with the desired name (& extension) of the Swapfile if you wish to change it from the default Win386.swp, e.g. pagefile.sys. This setting is more useful if you are sharing your Swapfile with another Operating system, e.g. Windows 2000. Although if you don’t intend to be doing this then simply ignore this setting.

MinPagingFileSize=x. x represents the Minimum size of the Swapfile. The value for x is in bytes (As stated earlier). E.g. If you wanted to set the Swapfile to a minimum size of 98MB then you should enter in 100352 (98*1024=100352).

MaxPagingFileSize=x. x represents the Maximum size of the Swapfile. The value for x is in bytes (As stated earlier). E.g. If you wanted to set the maximum size of the Swapfile to 198MB then you should enter in 202752 (198*1024=202752). Obviously you cannot set the Maximum size smaller than the Minimum size.

Save the changes you have made & reboot for the changes to take effect. If you renamed your Swapfile the old one may still exist, so check for & delete it if it does exist still.

Further optimizing the Swapfile

Once you have set your Virtual memory size you can further optimize it still. The Swapfile is best placed on the outer edge of the hard disk it is located on. Windows 9x\Me Disk Defragmenter won’t do this unfortunately. You’ll need a disk defragmenter like Norton speed disk to do so.

It is not recommended that you put your Swapfile onto a separate partition as this will increase the time to access it & increase hard drive head movement as well. Instead, it is recommended that it be placed on the most used partition of the least used drive. This will mean the C:\ drive where Windows is installed for users with a single hard drive. If you have another hard drive installed you should use that instead. To change where the Swapfile is located, change the Hard disk location or PagingDrive= when setting Virtual memory.

Ideally you will be able to place your Swapfile onto a separate hard drive, on a separate IDE channel (Do not put 2 hard drives on the same IDE channel). Again, it should go onto the outer edge of that hard drive too.

Vcache

By default Windows will determine these settings based on RAM installed (Well, the Min/MaxFileCache anyway). Of course, as with the Virtual memory settings before it is generally far better to set these yourself. Vcache is limited to a maximum cache size of 800 MB – this really shouldn’t matter to anyone but those with excessive amounts of RAM (Greater than 512MB. On such high RAM systems not limiting the Vcache has been known to cause problems).

Click on Start, Run. Type in system.ini & hit Enter. Scroll down to the [vcache] section. Under that heading Add/Edit the following lines as appropriate. To convert a value into KB’s use either MB*1024 or Bytes/1024, e.g. 16MB = 16384KB (16*1024).

MinFileCache=x. x sets the Minimum disk cache (in KB’s) on your system. This setting directly affects the physical RAM you can use on your machine, the higher you set it the less RAM will be available to applications. I’d recommend setting this to 1/8 your RAM.

MaxFileCache=x. x sets the Maximum disk cache (in KB’s) for your system. This setting directly affects the physical RAM you can use on your machine, the higher you set it the less RAM will be available to applications. I’d recommend setting this to 1/4 your RAM, i.e. Double the MinFileCache.

It is definitely worthwhile testing out different settings for these, although the recommendations are what works best for me.

Chunksize=x. Chunksize can also effect performance. Vcache is a single block of memory that is divided into chunks. If the Chunksize is too small it will occupy to many chunks & when set too large it will occupy too few chunks. The ideal value will lie in between these too extremes. x represents a numeric value that is a multiple of 512, e.g. 512, 1024 & so on. Depending on your Min/MaxFileCache settings a good starting value for x would be 512 or 1024.

These next 2 settings should be set in accordance with the Typical role of this computer setting (Right click on My Computer select Properties. select the Performance tab then the File system button). With the default selections Network server is the best recommended choice, although you can make your own Typical role(s) by following our Registry guide.

NameCache=x. x sets the limit on the amount of files Windows can track.

DirectoryCache=x. x sets the limit on the amount of directories Windows can track. Fixing the values has the advantage of Windows not having to re-allocate memory to increase/decrease the cache.

This table shows the entries to use for x depending on what you have selected & how much memory is used with each option (According to Microsoft).

Typical role of this computer

NameCache=

DirectoryCache=

Memory usage

Desktop computer

677

32

10K

Mobile or docking system

337

16

5K

Network server

2729

64

40K

Misc. stuff

Another way to reclaim RAM is to use the following script. In order to use a script you must have Windows scripting host installed on your machine, you can install it using the Windows setup tab in Add/Remove programs in the Control panel. It can be downloaded as a component of Internet explorer 5.5 also (Windows Millennium Edition users can ignore this).

You can get the file here. Unzip it to your Windows directory & create a shortcut to it. Put the shortcut in the Start menu (Or anywhere else you can easily access it), you can free up memory by just clicking on the shortcut. You should close all running applications before using it.

If you wish you can edit the amount of RAM it attempts to reclaim. Simply right click on the script file & select Edit. Increase the 16 to a higher number as you see fit, although do not set it higher than the amount of RAM you have installed.

Now open the config.sys/autoexec.bat (Located in your root directory where Windows is installed, generally C:\) file. Find this line:

DEVICE=C:\WINDOWS\EMM386.EXE

Delete this line or, put a REM in front of it. This is a DOS memory manager, some switches to this line can place a limit on RAM available in Windows.

Conclusion

By now you should have successfully optimised your memory system (both Virtual & Physical). With a bit of luck you should notice less hard drive accessing & improved memory subsystem performance. Make sure to check out our other Tweaking guides for optimising other components of your system.


Go to 3D Spotlight !