How to Get available bytes of Windows system using C#
I am facing one problem while retrieving available bytes of system through System开发者_开发技巧.Diagnostics namespace and I tried in this bellow code.
PerformanceCounter pc = new PerformanceCounter("memory", "Available Bytes");
Even using above coding I am unable to get, if I get the available bytes for the system that is not equals to Task manager counters.
In Which way I can find solution for this.
Thanks in advance.
Rajesh
Take a look at this TechNet page which contains tables mapping the Task Manager column names to the performance counter names.
I say this as it could be you are comparing two values which represent different aspects of memory usage: my guess is you are comparing the total memory value in TaskManager with the physical memory ('Available Bytes') performance counter.
The solution would be either to switch to the 'Committed Bytes' performance counter for total memory, or to compare the figure you are getting with the 'Physical Memory Available' value in TaskManager.
精彩评论