Native memory very large, can't figure out why!

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
dankarmy
Posts: 3
Joined: Fri Apr 04, 2008 12:04 am

Native memory very large, can't figure out why!

Post by dankarmy » Fri Apr 04, 2008 12:09 am

Hi,

I have recently downloaded v3.1 of memory profiler.

When profiling my asp.net web app, it says the total number of live bytes is around 1.9mb. However when I switch to Native memory tab - physical memory is at 49,850kb and committed memory is at 89,120kb. Which seems incredibly high!


Breakdown:

Physical memory:

Private > Code (3,868kb)
Private > Data (30,440KB)

Shared > Code (3,492)
Shared > Data (876kb)

Potentially shared > Code (10,212kb)
Potentially shared > data (964kb)

Now if I expand the Private > Data node i see an entry "<Unidentified>" and sitting at 29,664kb! What does this mean?

Cheers

John

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Fri Apr 04, 2008 3:21 pm

The <Unidentified> node represents allocated memory that the profiler has not been able to identify.

Do you have the resource tracker enabled? If not, then I recommend that you enable it. The data collected by the resource tracker will be used to identify additional native memory.

You can read more about the <unidentified> node in my blog at:

http://www.scitech.se/blog/index.php/20 ... ther-node/

Note that when I wrote that post the node was named <Other> and data collected by the resource tracker was not used in the native memory view.
Best regards,

Andreas Suurkuusk
SciTech Software AB

dankarmy
Posts: 3
Joined: Fri Apr 04, 2008 12:04 am

Post by dankarmy » Fri Apr 04, 2008 4:37 pm

Image

You can see from this that there is over 12mb in virtual memory, 5mb in Heap Memory and 2mb in Local Memory.

What do you suggest I look for next?

Cheers

John[/img]

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Mon Apr 07, 2008 2:34 pm

You can get more information about the unmanaged memory usage by investigating the allocation stacks of the Virtual memory and Heap memory. If the memory usage is caused by your application, the call stacks might give you an idea about what's causing the memory usage.

I don't think that the unmanaged memory usage is unreasonable for an ASP.NET application, unless the memory usage keeps increasing. In your screenshot the memory usage increased with about 70KB between the snapshots, which does not sound too much. Does the unmanaged memory usage increase over time?

Are you still seeing a lot of unidentified memory in the Native memory view?
Best regards,

Andreas Suurkuusk
SciTech Software AB

dankarmy
Posts: 3
Joined: Fri Apr 04, 2008 12:04 am

Post by dankarmy » Tue Apr 08, 2008 10:22 am

Andreas,

Thanks for coming back to me.

Yes over time, say if I click simulate the user natural progression through the site (maybe 20 pages or so) the memory peaks at around 100mb:

Image

I have viewed the call stacks for the Heap Memory, but can't see any user code. I dont recognise any of those lines:

Image

Any Ideas?

Thanks

suvetar
Posts: 4
Joined: Thu Aug 10, 2006 4:54 pm

Post by suvetar » Tue Apr 08, 2008 11:04 am

I've had similar experience in my companies App.

Are you dynamically loading UserControls or something like that? I have lots of assembly parsing because of that as our product is designed to generate pages dynamically and on-the-fly.

You might also notice that the non-public pool in the ASP.Net Cache has lots of data in it, that you didn't put there. That's the Assembly loader/parser caching itself.

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Wed Apr 09, 2008 9:57 am

As suvetar mentions, dynamically generated classes will cause additional unmanaged memory usage. The memory usage for these classes will not be reclaimed until the application domain is unloaded.

The call stack for the HeapMemory instance indicates that it was created while loading an assembly. Whether this is the main cause for the high memory usage I don't know. If you investigate the details of the Heap Memory resource you might get more information.

However, considering the complexity of the ASP.NET framework and the .NET runtime, I don't think the memory usage is too excessive. If the profiler induced data is excluded, the private working set is less than 35MB.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests