Red Gate forums :: View topic - Several questions about Memory Profiler
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
ANTS Memory Profiler Previous Versions
ANTS Memory Profiler Previous Versions forum

Several questions about Memory Profiler

Search in ANTS Memory Profiler Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
RinkeB



Joined: 02 Aug 2011
Posts: 5
Location: Leeuwarden

PostPosted: Tue Aug 02, 2011 2:55 pm    Post subject: Several questions about Memory Profiler Reply with quote

Hello there,

After reading the articles on the .NET tools resource center page, I still have a few questions about the Memory Profiler application.
For your information, I installed the application on a virtual server (Win 2008 with IIS) and I am profiling the memory usage of asp.net MVC applications.

I was wondering why there are thousands of string objects and hundreds of Byte[] and Int32[]? Most of them are not my code. Where do they come from?

And what does the 'Number of large fragments' section under the title 'Memory fragmentation' mean? Because it shows 2 (100% of free memory). What exactly is this?

Greetings,
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Wed Aug 03, 2011 4:59 pm    Post subject: Reply with quote

Hello,
Unfortunately in order to understand the problem this will require a deep understanding of web applications, rather than profiler. However, I can tell you that, since web applications almost exclusively return data that is of type "string", for instance, HTML pages, invariably the type with the most instances will be string. This doesn't mean something is wrong. It means the .NET runtime is producing these.

If you can please back up and let us know what kind of problem you think you may have with this website, we can give better advice about what you may need to look at to find the problem.

Lots of websites are problematic by nature because they store state too long or start to thrash when they reach their limit of simultaneous sessions.
Back to top
View user's profile Send private message
RinkeB



Joined: 02 Aug 2011
Posts: 5
Location: Leeuwarden

PostPosted: Thu Aug 04, 2011 9:31 am    Post subject: Reply with quote

Well my problem is the following. I'm profiling MVC websites of our company to see if I can lower the memory usage.

Even the most simple websites are already using 32mb, and a simple statistics application for running processes constantly uses 50-60mb.
I am talking about private bytes here.

In the summary section the program shows '.NET is using 6,195mb of 27,35mb total private bytes allocated to the application'.
In my understanding these numbers are explained as following:

6,195mb = gen1 + gen2 + large object + unused mem.
27,35mb = the above + unmanaged.

And the total size of objects in snapshot X = gen1 + gen2 + large object.

Are my assumptions true?

I am wondering how private bytes can be that high.
Where does the increase come from in comparison to the numbers i've just given.

And I think i've posted this topic in the wrong section. Shouldn't it be in the normal Memory Profiler section? I am using 7.0.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Thu Aug 04, 2011 9:36 am    Post subject: Reply with quote

I don't think the memory usage you see in the web app is that extreme, to be honest. And as you pointed out it's mostly unmanaged, so probably stuff IIS uses internally that you can't do a thing about.

I think Andrew had delivered a pretty thorough explanation you may be interested in.
Back to top
View user's profile Send private message
RinkeB



Joined: 02 Aug 2011
Posts: 5
Location: Leeuwarden

PostPosted: Thu Aug 04, 2011 10:22 am    Post subject: Reply with quote

Andrew is mostly talking about Virtual Bytes, which isn't the issue here I think.

I'm still wondering what's the difference between the the private bytes in the line graph (~50mb) and the private bytes on the top of the summary page (26,38mb).

picture

What does explain this difference?
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Thu Aug 04, 2011 10:33 am    Post subject: Reply with quote

I think this is one of those cases where the performance counter is wrong because it doesn't update until after garbage collection.
Back to top
View user's profile Send private message
RinkeB



Joined: 02 Aug 2011
Posts: 5
Location: Leeuwarden

PostPosted: Fri Aug 05, 2011 8:30 am    Post subject: Reply with quote

Well, when I force a garbage collection by taking a snapshot, the counter decreases some, but there is still a big difference between the two numbers. This is the case for every MVC project I profile. Can I assume the counter is wrong for all projects of this kind or is there something else going on?
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Fri Aug 05, 2011 10:01 am    Post subject: Reply with quote

There is another discussion about the discrepancy here: http://www.red-gate.com/messageboard/viewtopic.php?p=33481#33481
Back to top
View user's profile Send private message
RinkeB



Joined: 02 Aug 2011
Posts: 5
Location: Leeuwarden

PostPosted: Thu Aug 11, 2011 2:06 pm    Post subject: Reply with quote

Quote:
No: private bytes includes free space on the .NET heaps as well as unmanaged memory usage. You can find out which is responsible by looking at the breakdown at the bottom of the snapshot summary page: the free space on all .NET heaps value is included in the private bytes.

So what explains the difference between the value in the line graph and the value in the summary box? The line graph includes all free space reserved by the whole of .NET?
I'm still quite confused about this. Sometimes the line graph value is twice as big as the summary value.
I hope you can give me some info on this, because i encounter this at all my MVC applications.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6644

PostPosted: Thu Aug 11, 2011 2:19 pm    Post subject: Reply with quote

The answer is yes, it's just that simple. Once set of data is Profiler tallying up the size of the objects and the other is the performance counter data (nothing to do with us, it is generated by Windows) which includes all of the unmanaged resources, and ANTS is not capable of tracking those resources. In either case the data is not for all of .NET but the private bytes size in the performance counter includes the .NET runtime loaded into the process.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group