Well, I have to debug a memory allocation issue. The application runs out of memory over time. I need to simulate low memory system for a .net window app, as a way to reproduce the out of memory issue more quickly.
PS: My initial investigation suggests that the memory leak is occurring while the application is allocating unmanaged resources (Managed DX).
You can simulate a memory leak by simply adding objects to a global list on a timer.
Start the debug diagnostic tool and select 'Memory and handle leak' and click next. Select the process in which you want to detect memory leak. Finally select 'Activate the rule now'. Now let the application run and 'Debugdiag' tool will run at the backend monitoring memory issues.
static volatile byte[] wasted; //volatile to avoid any compiler cleverness "saving" us!
static void Main(string[] args)
{
wasted = new byte[1024 * 1024 * 1024];//waste a gig!
}
It could also be well worth running the Application Verifier on your app.
Write another program that allocates all of your system's memory :)
Alternatively, debug in a VM with low memory
In addition, I'd suggest you to use a .NET profiler so you can check which area of your program is allocating more memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With