Define available memory that can be used before an OutOfMemoryException is thrown.

OutOfMemoryException for my applications is thrown before the system itself OutOfMemoryException out of memory, as explained:
MSDN Blogs - Out of Memory? Simple ways to increase the amount of memory available to your program.

When you run the C # application, you can get an OutOfMemoryException throw even if your machine has a lot of memory. [...] This 4 Gigs is split in half: the user application gets the bottom half, and the OS gets the top. (This boundary can be changed: see below).

Upon request, I need to visualize how much memory is available for my application and current use. Current usage can be obtained using Process.GetCurrentProcess(); and others, but how do I determine the memory available to my application at runtime? I just can't understand.

+4
source share
2 answers

You can use MemoryFailPoint to check before a large distribution. This is not exactly what you are asking for, but if your failure is at a certain known point of high allocation, it at least allows you to clearly handle the distribution failure at the point at which it occurs.

+1
source

“Memory limits for Windows release (Windows)” have the answers you are looking for, unless you are running any other operating system.

You can check [question]: how to check if exe is set as LARGEADDRESSAWARE

-1
source

All Articles