Facing Memory leak in asp.net application

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
ashish_chilke
Posts: 6
Joined: Mon Feb 06, 2012 2:26 pm

Facing Memory leak in asp.net application

Post by ashish_chilke » Fri Feb 10, 2012 12:15 pm

We are facing the problem is that the Application Pool of our ASP.net application recycles frequently.
we have observed that the size of Large Objects Heap (LOH) becomes very large.
How can we solve our problem ?

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

Re: Facing Memory leak in asp.net application

Post by Andreas Suurkuusk » Sun Feb 12, 2012 8:37 pm

There is a "Large instances" filter included in .NET Memory Profiler. This filter will give you information about the instances that are located in the LOH (see screenshot below).
largefilter.png
Large instances filter
largefilter.png (26.21 KiB) Viewed 10136 times
If you double-click on this filter, you can get detailed information about allocation stacks and root paths of the instances in the LOH. Hopefully this should help you find out why the LOH memory usage is high. If you select the "High" profiling level, you will get more detailed information about each allocation in the large instance heap, but your program will run much slower.

There's also a possibility that the utilization of the LOH is not very good. Under the "Native memory" page, you will get information about the overhead of the large object heap (see screenshot).

Bad utilization of the LOH can be caused by certain allocation patterns, but it is more difficult to debug. Hopefully, this is not what's causing you high memory usage in the LOH.
Attachments
largenative.png
LOH native memory
largenative.png (33.57 KiB) Viewed 10136 times
Best regards,

Andreas Suurkuusk
SciTech Software AB

Guest

Re: Facing Memory leak in asp.net application

Post by Guest » Mon Feb 13, 2012 12:54 pm

Hi,
We got a lot of instances are locating in LOH.
We checked instances detail and call stack. From them most of instances are pinned.
We want to locate where these instances are created and why pinned.
How can we trace the perfect location of that instances are created in our source code.
Image
Thanks in Advance.
Ashish

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

Re: Facing Memory leak in asp.net application

Post by Andreas Suurkuusk » Tue Feb 14, 2012 4:49 pm

You can find out of how an instance is pinned by looking at the allocation call stack of the pinning GC handle (#268 in your example). If you hover with mouse over the #268 instance in the instance graph you will see the allocation call stack.

However, the pinned instance in your example is an object[]. Pinned object[] arrays are usually used for static fields and is probably not what's causing your high memory usage in the large object heap. How much memory do the object[] instance occupy in the large instance heap?
Best regards,

Andreas Suurkuusk
SciTech Software AB

ashish_chilke
Posts: 6
Joined: Mon Feb 06, 2012 2:26 pm

Re: Facing Memory leak in asp.net application

Post by ashish_chilke » Tue Feb 14, 2012 6:32 pm

I m not able to getting how to locate perfect location for instances from call stack for our source code.
i wanna to know where that instances are created in our source code.

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

Re: Facing Memory leak in asp.net application

Post by Andreas Suurkuusk » Wed Feb 15, 2012 10:43 am

I'm not sure what you mean with "perfect location". Can you clarify what you are looking for?

The allocation call stack will tell you how the instance was created. If you are able to find one of your methods in the call stacks, you will get information about how the allocation was initiated by your code. However, since the allocation could occur within components not written by you, it is not always possible to directly associate the allocation with your own code.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests