sometime, i can create a 10000x10000 bitmap, sometime i can't
depending on how much available physical RAM is free
I would like to know if there a way to figure out before the process start if there enough memory or not
sometime, i can create a 10000x10000 bitmap, sometime i can't
depending on how much available physical RAM is free
I would like to know if there a way to figure out before the process start if there enough memory or not
You can use this to get the current process:
Process proc = Process.GetCurrentProcess();
And then use this to get the private memory usage:
proc.PrivateMemorySize64;
You could also do this (using System.Diagnostics.PerformaceCounter):
protected PerformanceCounter ramCounter;
ramCounter = new PerformanceCounter("Memory", "Available MBytes");
var freeRAMInMB = ramCounter.NextValue();
The above would get the the amount of free RAM in MB...