intentially create program with large run-time memory
I'm working on a suit of tests to be run on a brand new high performance computer and trying to run some performance tests to see how well it manages forks, IO, memory usage ect.
Anyways I want to create multiple programs, one that requires 1 MB to load into memory, and then a number of increasingly larger programs. I'm not trying to test the heap, already have a test for this, but the memory to load the program into the stack. The question is how do I do this? I see two problems
1) I don't want to sit there putting 1000 no-ops (or C++ equivalents) in my code just to increase it's size, I'm assuming there is a quicker way to do this.
2)I don't want the compiler to realize the program is needlessly complex and optimize it (although I assume that I can do that by simply not using the -02 argument?)
Would just creating a program with a large int array that is never used and compiling it without the -02 flag do this?