The OutOfMemoryException
for my applications is thrown way before the system itself runs out of memory, as explained by:
MSDN Blogs - Out of memory? Easy ways to increase the memory available to your program.
When you run your C# application, you might get an
OutOfMemoryException
thrown, even if your machine has lots of memory. [...] That 4 Gigs is divided into half: the user application gets the lower half and the OS gets the upper. (This boundary can be changed: see below).
By request, I need to visualize how much memory is available for my application and the current usage. Current usage can be retrieved using Process.GetCurrentProcess();
and others, but how to determine the memory available to my application at run-time? I just cannot figure out.