Home
About
Contact
Tuesday, October 31, 2006

In my last post about memory leaks, I emphasized the importance of calling Dispose. This time I’m going to talk about how you can see how much memory your application is using.

You probably think that I think you’re stupid… Right? Right now you say to your self

Of course I know where to find my app’s memory usage! I’m not f$£@&g stupid!

Ok. I get it. You of course go to the task manager and look at the memory usage column for you app. Right? Wrong. Don’t do that. It dos not tell you anything about your app’s memory usage. Why? First here’s an example to make a point (or rub it in…):


.Net application just started.

Here I have started my test application and as you see it has a memory usage of 11 696K.

The funny thing is that if you minimize the application it only has a memory usage of 812 K.


.Net application minimized.

What happened? Did all my objects just disappear when I minimized my app. I don’t think so! The problem is that Mem Usage equals working set (http://support.microsoft.com/kb/293215). And what dos working set tell you? One of the more common definitions of working set is;

The working set of a process is defined as the number of virtual memory pages that it is allowed to keep resident in RAM.

In other words; it dos not tell you how much memory your app are using.

Now we know that Mem Usage is not much use to us, what CAN we use? What you want is your applications private memory. Private memory is the actual space in memory your application use. And as it happens, you can find that column in Task Manager as well… Only it’s called Virtual Memory. Go figure. In Task Manager go to View -> Select Columns…, and select Virtual Memory.

So my advice to you is to get rid of the Mem Usage column and replace it with Virtual Memory. Do this on all the computers at your office and tell everyone!

OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview
RSS RSS - Comments Twitter LinkedIn
         
SEARCH
 
 
         
TOP POSTS
   
         
NAVIGATION
   
         
CATEGORIES
  .Net (61) ADFS (3) Agile (31) Ajax (5) Architecture (20) Articles (1) ASP.NET (7) ASP.NET-MVC (1) Blogging (12) Books (2) BPEL (1) CleanCode (1) CloudComputing (7) Community (5) CSharp (11) DasBlog (5) Database (2) DDD (5) Deployment (17) DSL (1) Events (38) ExtremeProgramming (6) Fun (6) Gadgets (4) IIS (10) InfoQ (4) Java (2) Kanban (1) Lean (3) Linq (2) MemoryLeaks (5) Microsoft (37) MVC (1) NDC (2) NNUG (37) Other (10) Patterns (9) Performance (3) Scrum (17) Security (7) ServiceBus (1) Silverlight (4) Software (19) TeamManagement (12) TechEd (7) Testing (5) Tools (25) TvGuide (1) Vista (15) VisualStudio (16) WCF (8) Web (16) WebDeploy (2) WIF (3) Windows (10) WiX (9) Work (18) Workflow (3)  
         
ARCHIVE
   
         
BLOGROLL
   
         
ON THIS PAGE...