So I want to test my windows application under low memory conditions, and I have found that the easiest way to do this is to create another app (a Console application) that just hogs memory.
I have created this monster:
while (true)
{
try
{
Marshal.AllocHGlobal(1024);
}
catch{}
}
But it only goes to 3.7 GB. I then open another instance of this application and it goes back down.
How can I keep the garbage collector from collecting my allocations?
Or: how can I test low-memory conditions on my universal windows application?