Measuring total system memory
-
Hi I would like to know how I can estimate the total physical memory usage (as well as availability) for the entire system, so I can display the usage figures in my application. Is there a class in the .NET framework I can use? If not, is anybody aware of any libraries I can download that contain such a class? Furthermore, I would like to be able to invoke the GC and collect garbage from all processes running on the system. Again, I would appreciate it if someone could point me to a class that provides these facilities. I have tried using the GC class, but I can only collect garbage for my own application. Thanks in advance :). Ray
-
Hi I would like to know how I can estimate the total physical memory usage (as well as availability) for the entire system, so I can display the usage figures in my application. Is there a class in the .NET framework I can use? If not, is anybody aware of any libraries I can download that contain such a class? Furthermore, I would like to be able to invoke the GC and collect garbage from all processes running on the system. Again, I would appreciate it if someone could point me to a class that provides these facilities. I have tried using the GC class, but I can only collect garbage for my own application. Thanks in advance :). Ray
You can use WMI to obtain the amount of physical RAM by adding a reference to the
System.Management
namespace. You would query the Win32_PhysicalMemory provider. A quick search on CodeProject showed this article: http://www.codeproject.com/cs/system/GetHardwareInformation.asp I'm sure that forcing GC on all processes is impossible as not all applications are managed. I however look forward to reading any other comments.Regards Wayne Phipps ____________ Time is the greatest teacher... unfortunately, it kills all of its students View my Blog