How can I tell the application total memory usage?

Posted on 2006-03-27 09:30  A.Z  阅读(247)  评论(0编辑  收藏  举报
From: willy.denoyette@telenet.be (Willy Denoyette [MVP])
Date: Aug 14 2005 20:40:04

 

"S. Senthil Kumar" <senthil.thecoder@gmail.com> wrote in message
            news:1124041076.357101.171000@g44g2000cwa.googlegroups.com...
            > So private bytes plus the address space required for mapping exe, dll
            > and memory mapped files will be equal to the virtual bytes counter?
            >
            > Regards
            > Senthil
            >
            No, the "Virtual bytes" are the VAS (Virtual Address Space) pages actually
            allocated to the process, these consist of what's more or less mentioned
            above plus the Virtual allocated memory that's been reserved but not yet
            committed.
            For instance when the CLR initializes, it allocates 2 segments of 32MB each
            from the VAS for the GC heap, so you will see the "Virtual bytes" value grow
            by 64 MB when this is done.
            At the start of the EE only 2 pages are committed from this 64MB so the
            "Private bytes" don't increase at this point, however, when the program
            starts executing managed code and objects are getting loaded in the GC heap,
            the number of committed pages start to increase, and obviously you'll see
            the "Private bytes" (and Page file bytes) increase accordingly.
            The number of committed (GC heap) bytes from this "initial heap" never
            decreases, additional segments allocated during runtime might get returned
            to the OS when they are no longer needed by the CLR, so it's possible to see
            the Private bytes decrease, but only if they come from additional segments
            that are getting retuned to the OS.
            Willy.