Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Measuring total system memory

Measuring total system memory

Scheduled Pinned Locked Moved C#
csharpdotnetperformancequestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chatnoir
    wrote on last edited by
    #1

    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

    W 1 Reply Last reply
    0
    • C chatnoir

      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

      W Offline
      W Offline
      Wayne Phipps
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups