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. .NET (Core and Framework)
  4. Accessing memory usage for current Application (or AppDomain)?

Accessing memory usage for current Application (or AppDomain)?

Scheduled Pinned Locked Moved .NET (Core and Framework)
performancecsharpquestion
5 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.
  • J Offline
    J Offline
    Jon Rista
    wrote on last edited by
    #1

    Is it possible to access the current memory usage values for the running application, from within the applications own code? I have had a hard time finding documentation on this. At first I tried to use the performance monitor classes, but I can't see a way to load up a performance monitor for the current process. Is this possible in .NET? I appreciate any replies.

    J 1 Reply Last reply
    0
    • J Jon Rista

      Is it possible to access the current memory usage values for the running application, from within the applications own code? I have had a hard time finding documentation on this. At first I tried to use the performance monitor classes, but I can't see a way to load up a performance monitor for the current process. Is this possible in .NET? I appreciate any replies.

      J Offline
      J Offline
      je_gonzalez
      wrote on last edited by
      #2

      long memUsed = System.GC.GetTotalMemory(true/false); True if you want to force a garbage collection before computing the memory used.

      J 1 Reply Last reply
      0
      • J je_gonzalez

        long memUsed = System.GC.GetTotalMemory(true/false); True if you want to force a garbage collection before computing the memory used.

        J Offline
        J Offline
        Jon Rista
        wrote on last edited by
        #3

        Hmm...I was looking for a finer grained level of detail....the kind of info you can get from perfmon. Physical and Virtual memory usage, garbage collection counts, propmotions, etc.

        J 1 Reply Last reply
        0
        • J Jon Rista

          Hmm...I was looking for a finer grained level of detail....the kind of info you can get from perfmon. Physical and Virtual memory usage, garbage collection counts, propmotions, etc.

          J Offline
          J Offline
          je_gonzalez
          wrote on last edited by
          #4

          Does http://www.aspheute.com/english/20000809.asp help?

          J 1 Reply Last reply
          0
          • J je_gonzalez

            Does http://www.aspheute.com/english/20000809.asp help?

            J Offline
            J Offline
            Jon Rista
            wrote on last edited by
            #5

            Well, not really. I know how performance counters work, how to create them, etc. etc. My question is how to I get a performance counter, in say the .NET GC category, for the "current", that beeing the key word, process. The process that I'm actually instantiating the performance counter from? This is not a web application, its a windows forms application. I'm not trying to recreate the perfmon application, I don't want to view performance counters for "other" processes....I want to view them for the process from which I instantiate the counter. I've looked and looked, but there doesn't seem to be a site on the net or a single word in the .NET documentation that says how to get a counter for the current app, the one that instantiates the performance counter itself. The current instance is what I'm inclined to call it, but there doesn't seem to BE a current instance, only global instances and specific instances for some apps.

            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