Вселенная Кудзу

«Программирование - искусство, воюющее со своими творцами»

Kudzu World  »  Blogspace  »  Kudzu's Tech Blog
English - Română - Русский - عربي

RSS Feed

If you want to more easily stay informed of updates etc you can subscribe to the RSS feed. Just point your RSS reader at this page, auto discovery is enabled.

RamDisk + Source Code = Super Fast Development


RamDisks seem to have been vilified over the past decade, or at least shunned. Most say they are not needed because of SuperFetch, etc. For the average user this is true, but for developers this is false. Developers can benefit greatly through the use of a RamDisk.


SuperFetch is a feature of Windows which caches executable code in spare memory so it is available when needed. Windows also uses available RAM for other types of disk cacheing. However it makes a best guess on what to cache, and is tuned towards average end users.


Developers can benefit from moving the following types of files to a RamDisk:

I have moved several of my larger projects to use a RAM drive. I formerly had 4 GB of RAM and dedicated 1 GB to a RAM disk. 1 GB holds a lot of source code and output. You can also use backing images and change the RanDisk contents depending on the project you are working on at that moment. I've now upgraded to 8 GB, but still only dedicate 1 GB of RAM to my RamDisk, and find it is more than sufficient for my needs, even on large projects such as Cosmos. Cosmos even with outputs, ISOs, etc uses only 256 MB.

Since moving to a RamDisk, my builds have reduced in time by 10-20x in many cases.

RamDisk Software

I have spent the last few weeks evaluating different RamDisk software packages. Unfortunately since most do not feel RamDisks are important, there is a lack of software. There are about a dozen packages, many marginal. After trying several I have chosen ImDisk. Aside from the Control Panel applet, it works fine on Windows 7 x64.

Imdisk cannot load and save the RamDisk during start up and shutdown, but that turns out to be OK. Other RamDisk software I tried could do this, but it was very slow to save the whole image, and often caused "stalled" boots and shut downs. Instead I have created a bat file that initializes the RamDisk and initializes the contents form a directory on my hard drive. At shut down, I save the contents using another batch file.

Startup Batch File

imdisk -d -m M:
imdisk -a -s 1G -m M: -p "/fs:NTFS /V:MemDisk /q /y"

mkdir m:\Temp

xcopy D:\MemDisk\*.* m:\*.* /E /K /H /R /Q

imdisk must be run as Administrator, so run the batch file as administrator. Batch files cannot be set to auto run as admin, but you can automate this by creating a shortcut to the batch file, and using the advanced button on the shortcut tab of the shortcut properties. Do not try to use the compatibility tab, run as admin will be disabled there.

Shutdown Batch File

del m:\temp\*.* /S /Q /F
rmdir m:\temp

REM Have to copy all, not just archived, else deleted files will reappear on boot
del D:\MemDisk\*.* /S /Q /F

xcopy m:\*.* D:\MemDisk\*.* /E /K /H /R /Q

imdisk -d -m M:

Shutdown Failure

Forget to run shutdown or your system crashed? Its not a big deal. The RamDisk is only backed up because it is faster to reinitialize from the hard drive rather than doing a complete source check out again. Binary outputs are also restored, so a build rather than a full compile can proceed immediately. Only files which can be recovered should be moved to the RamDrive. Checking in often also helps in case of a failure to execute the Shutdown batch file.

Special Note

I've found ImDisk to be very reliable so far. However the detach command often does not work, and running a second attach command can create two drives using the same letter. The DOS window will see one, while the Windows shell will see the older one. Because of this, do not run the Startup file more than once. If you need to reinitialize, only use the copy commands and not the imdisk -a.

<< Previous Entry    Next Entry >>


-- No Comments --

Post a comment

Use my contact form to contact me directly.