I'm studying the I/O efficiency of an algorithm written in c++ and I need to test the performance on a machine with 256MB of ram. Is there any way to boot up my Ubuntu machine in console mode with just 256MB of main memory? Thanks, Stefano
Asked
Active
Viewed 49 times
0
-
3Possibly of interest: https://help.ubuntu.com/community/VirtualBox – shuttle87 Jun 20 '14 at 13:48
1 Answers
1
There are several ways to do this:
You can install virtualization software on your computer (VMWare, VirtualBox, ...). The software will allow you to create a virtual PC with the amount of RAM that you want for your test. The software will allow you to change the memory size very quickly.
You can boot linux with the kernel option
mem=256m
. See here.At the beginning of your code, you can ask for the amount of free memory and allocate a huge chunk so that only 256MB are left free.
You can run your code with a profiler and ask how much memory it used.

Aaron Digulla
- 321,842
- 108
- 597
- 820
-
Thank you so much. I'm interested most in the 4th option. Could you please provide me some reference regarding this? – pedro.zena Jun 20 '14 at 14:22
-
1See this question: http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux – Aaron Digulla Jun 23 '14 at 08:35