Need C# code that will eat up system memory.

Viewed 6453

I need the opposite of good, optimized code. For testing purposes I need a simple program to eat up RAM. Preferably not all memory so that the OS is non-functional, but more like something that would simulate a memory leak, using up a lot of memory and slowing down the OS, gradually, overtime.

Specifically, can anyone provide code spinets or links to tutorials I can use?

I saw this code as a suggestion on another post:

for (object[] o = null;; o = new[] { o });

But it is not quite what I am looking for as per the description above.

Please help.

3 Answers
Related