Is their is an Equivalent of Runtime class (of java) in c# Actually I am trying to convert these operation to c#
Runtime runtime = Runtime.getRuntime(); return runtime.totalMemory() - runtime.freeMemory();
Is their is an Equivalent of Runtime class (of java) in c# Actually I am trying to convert these operation to c#
Runtime runtime = Runtime.getRuntime(); return runtime.totalMemory() - runtime.freeMemory();
If you're just trying to get at the current memory usage, you want the GC
class.
For example:
long memory = GC.GetTotalMemory(true); // Allow a brief time for GC/finalization
The GC
class is also where you can find members to suggest garbage collection, wait for pending finalizers, and the like.