Virtual Memory Optimization

PLEASE NOTE: This article has been archived. It first appeared on ProRec.com in April 1998, contributed by then Contributing Editor Jose-Maria Catena. We will not be making any updates to the article. Please visit the home page for our latest content. Thank you!

Recording audio on a computer places demands on the computer never anticipated by the computer’s creators or operating system manufacturers.

For example, if you record on a large disk formatted with FAT32 in Windows 95, Windows will format the disk with small block sizes. This is an attempt to avoid wasting space, since the entire block is consumed even if it only contains a single byte. With “normal” sized files, small block sizes mean less wasted space. With audio, however, small block sizes mean excessive reads and poor disk throughput.

In a future article I will discuss the proper techniques for setting the right block sizes. For the moment I want to discuss Virtual Memory.

Windows’ default Virtual Memory settings are usually not good for audio. First of all, Windows likes to maintain a flexible swapfile size. This is good for typical usage because it allows Windows to increase the size of the swapfile as you load more and more programs into memory.

With audio recording, however, disasterous results can occur if you allow Windows to manage the size of the swapfile. You’ll be merrily recording the best take you ever heard, when BANG the recorder stops without warning, as Windows takes over and increases the size of the swapfile. TAKE LOST!

The folks at Microsoft didn’t want you to change the default settings, either. Here’s what happens if you decide to change the settings in the Windows System Control panel:

As if this message isn’t sufficiently scary, look at what happens if you bravely decide to disable Virtual Memory completely:

This is probably a good message to prevent newbies from getting in trouble. But if you’re going to get the most out of your computer-based recorder, you’ll need to be brave.

So the question is: what is the right size setting for virtual memory?

The answer is: it depends on your computer’s particular configuration: processor, physical RAM, etc..

The following technique will determine the optimal size for your computer’s Virtual Memory setting.

Warning! If you are not comfortable editing your system files – STOP NOW!! Read the entire procedure completely and make sure you are comfortable with each step before proceeding!

(1) Set the VCACHE settings in SYSTEM.INI
This is not VM, but file cache. To measure VM needs, you should first adjust these values, especially if you do not have much RAM.
[vcache] MinFileCache=0 MaxFileCache=X
X here is the maximum memory dedicated to file caching. File caching does not help audio applications, so set it low if you do not have much memory. I suggest the following values as starting points:
16 MB -> X=1024
32 MB -> X=2048
64 MB -> X=4096
above 64 MB -> X=8192
The objective is to avoid wasting too much RAM for file caching.
Restart the computer.

(2) Start the System Monitor and select a graph of ALLOCATED MEMORY
Start the audio programs you typically use concurrently. For example, if you usually work with Cakewalk and SoundForge load both programs.
Note the maximum values that allocated memory reach during normal use of your programs.

(3) Set the MINIMUM VIRTUAL MEMORY SIZE to a value somewhat higher than the maximum allocated memory reached
If you have extra disk space, don’t worry about setting a larger value.
You can set MAXIMUM VM SIZE to any larger value. Be sure to set it above the maximum memory you ever need. You can set it, for example to 512 MB. No problem, no performance degradation. The swap file will only grow if your programs allocates more memory than the minimum VM size set, that should be a rare case if you adjusted the min VM size as described in the previous point.
Restart the computer.

(4) Start the system monitor again and select VM PAGE MISSES graph.
Start your usual applications again and while using them see if there are too many page misses during normal operations. Some page misses during program focus change, for example, are aceptable, but not during file playback and the like. If there are many page misses, you’ll improve performance adding more RAM.

(5) Finally, some aditional information
– To defragment the VM file, disable VM, defrag, and set the VM again. This is needed only when changing the VM settings.
– Cakewalk, for example, uses only about 8 MB. To be safe double this to 16 MB to account for lots of effects and large audio buffers. Win95 + Cakewalk usually allocates about 40..50 MB.
– Place the VM on your fastest disk or partition. This should ideally be a different disk from your audio disk. Moving the VM file will speed up system performance when page misses occur, that is, when the physical RAM is insufficient. The swap file won’t cause disk fragmentation if adjusted as described, and so, it won’t affect audio file access.
– If you are getting too many page misses you should add RAM to avoid it. If it is infeasible to add RAM, place the swap file on a different disk to use all the available disk throughput for audio files: in this case, the disks should not be in the same IDE channel (only applicable to IDE disks).
– ALWAYS USE BUS MASTER DISK DRIVERS!!! If possible, use those included with Windows OSR2.
– Set the DMA option in all your disks (Control Panel -> System -> Disks…). This will free additional CPU bandwidth for audio processing.

Leave a Reply