Determine RAM volume size by installed RAM amount

2 posts

JamieM Guest
20 Oct

I would like to suggest, if it is even possible from a kernel driver point-of-view, to have a RAM volume's size determined by the amount of installed RAM, instead of a fixed value. This would be useful in test-bed scenarios where RAM modules are changed frequently, or just as a set-and-forget peace-of-mind feature.

The only Windows Kernel-level information I can find that could make this feasible is 'MmNumberOfPhysicalPages', but the way it works is... quirky, since it works in 'pages' instead of bytes.

For added safeguards, maybe 90% could make for a safe upper boundary?

Andrew SoftPerfect
20 Oct

You already can get close to this without a percentage setting. Create the volume with a very large size, say 1 TB, and hold Shift while clicking OK. That skips the check which normally limits a volume to the size of the installed RAM minus the volume size.

It works because memory is only taken as data is written, so a 1 TB volume holding 5 GB uses about 5 GB. The driver also refuses any new allocation once the system's free physical memory drops to 1 GB, regardless of the volume size. In practice the volume can fill until the machine has 1 GB left, whatever RAM is installed, so swapping modules needs no change.

This is actually more useful than a fixed 90% of installed RAM, because it follows what is really free rather than what is fitted. A percentage would happily let the volume grow while other applications are using the memory it was counting on.

Two things to be aware of:

  • Free space is reported against the volume size, so Explorer will show roughly 1 TB free, and an application that checks free space before writing will be told there is plenty of room.
  • What happens at the limit differs between the two products. RAM File System fails the write with "Insufficient system resources", so a large copy stops partway rather than being refused up front. RAM Disk needs Dynamic memory allocation enabled for any of this to work, and at the limit its writes pause until memory is freed, either by closing other applications or by deleting files from the RAM disk. NTFS hands that memory back sooner than exFAT does.
Reply
Shown with your post. Sign in to keep the same name every time.
(optional, never shown)
Only needed if you want notifications about replies.
Drag files here, paste a screenshot, or . Images up to 10 MB. Text, log and zip files up to 2 MB. Up to 5 files per post.
You can edit your post until someone replies.