How can I simulate a PC having less physical memory than it does to test performance?

1

Our application deals with large files, say 2Gb, and accepted wisdom is users need RAM 10X dataset size. Developers have well-specced machines but some users see horrible performance which we attribute to their much lower RAM, but can't categorically prove or measure.

Is there a way on Windows, Linux, Mac to 'hide' RAM from the OS without turning it off. Ideally at run-time i.e. not BIOS? Or even a utility which will gobble a requested amount of RAM and prevent other apps using it?

Our application also makes heavy GPU demands via OpenGL which makes VMs a tricky option. I know that Parallels and VirtualBox simply don't support the OpenGL version we use, others might but are sometimes pricey.

Mr. Boy

Posted 2018-09-19T17:46:46.567

Reputation: 3 710

3How about a VM? Only other way I can think of is to physically remove the RAM. Low RAM + old spinning rust HD will be even worse than SSD. – Tetsujin – 2018-09-19T17:49:09.077

@Tetsujin thanks for reminding me to add a note on that to my question... I'd forgotten – Mr. Boy – 2018-09-19T18:23:27.047

It's worthwhile keeping several generations of old PCs for QA purposes for exactly this reason. And it's cheap to get them if you don't have them already. Make sure you clean-format them before testing. – Christopher Hostage – 2018-09-19T20:19:06.067

Answers

2

There is.

On Linux, use the kernel command line parameter mem=. Add this option to the kernel command line in GRUB. Reference.

Windows has the /BURNMEMORY and /TRUNCATEMEMORY boot switches. Use bcdedit to add these switches or Reference. On Windows Vista and 7, F10 gets you into a pre-boot screen where you could add it for just that session, not sure how that works with Windows 10. Use BCDEdit option if not available. Another reference.

LawrenceC

Posted 2018-09-19T17:46:46.567

Reputation: 63 487

1

Deduct some available memory by creating a ramdrive, which will not impose the additional CPU cycle burden of a VM.

Ramdrives, or ramdisks, are discussed herein for Windows, Linux, and MacOS.

For Windows, one Open Source app is ImDisk, but there are many other choices.

Linux includes tmpfs but you have multiple other options here as well, such as the use of mem as a command-line option in the kernel, as noted in comments below by Austin Hemmelgarn.

For MacOS, you don't even need to create the ramdisk to obligate the memory; instead, as per the aforementioned link, do

hdiutil attach -nomount ram://1165430 /dev/disk4

K7AAY

Posted 2018-09-19T17:46:46.567

Reputation: 6 962

tmpfs isn't a package, and it's allocate-on-demand (it uses the same code as the page cache). You don't even need a real ramdisk on Linux for this though because you can specify an exact amount of memory to use on the kernel command-line with the mem= option. Anything beyond what you specify with that will not be used by software (except possibly firmware) at all. – Austin Hemmelgarn – 2018-09-19T18:26:48.770

-1

Another idea: You can configure a virtual machine with whatever amount of RAM you want and run the app in there to see how it behaves.

Hefewe1zen

Posted 2018-09-19T17:46:46.567

Reputation: 1 316

Paragraph 3 of the question: "Our application also makes heavy GPU demands via OpenGL which makes VMs a tricky option." – K7AAY – 2018-09-19T22:11:22.403