Snapshot Causes Unmanaged Allocation Growth

Memory profiling for .NET developers

Moderators: Luke Jefferson, StephenC, AndrewH, melvyn.harbour, james.billings, Laura Morley, dene.boulton

Snapshot Causes Unmanaged Allocation Growth

Postby mdgarrett » Thu Aug 11, 2011 8:53 pm

Had a report of a memory leak in an application, have been trying to verify the leak but unfortunately I am hitting a bit of a road block. The application does have some win32 calls, and in the past, I've used the profiler to help determine if some of my DLLs which were being marshalled had a leak in them. I now am noticing (perhaps this has always been there?) that taking a snapshot seems to raise the unmanaged allocation. To test this, I created a blank windows form and then profiled it. If I take snapshots fairly close together, the unmanaged allocation starts rising pretty quickly. If i leave it sit there for hours, it stays exactly the same. Is this expected? If so, is there a reliable way to use this product to test more than managed memory leaks? I do understand the product can't profile my instances, calls, etc. in the win32 calls, and i'm ok with this, but it would be nice to be able to tell, at a glance, if the unmanaged allocation was rising continuously with the utility. This way I could at least confirm/deny whether or not the win32 calls are leaking at all.
mdgarrett
 
Posts: 5
Joined: Thu Aug 11, 2011 8:43 pm

Postby mdgarrett » Thu Aug 11, 2011 9:22 pm

Also, I'm using version 7.0.0.731 of the Memory Profiler utility. The application I used to test was a .net windows form compiled in VS 2008 with framework 3.5.
mdgarrett
 
Posts: 5
Joined: Thu Aug 11, 2011 8:43 pm

Postby mdgarrett » Thu Aug 11, 2011 9:49 pm

Not sure if this helps at all, but I did this test with a console app as well. It took numerous snapshots before it raised at all. It definitely raises much more slowly, which is probably why I've never noticed it before. I rarely do much work with non-service type applications, and when I do, usually they are more console based applications. This is the first GUI app that makes win32 calls that i've ever tested with the Memory Profiler utility..
mdgarrett
 
Posts: 5
Joined: Thu Aug 11, 2011 8:43 pm

Postby Brian Donahue » Mon Aug 15, 2011 9:47 am

Hi,

This seems consistent with the way ANTS Memory Profiler works because part of it does run inside the process being profiled. When you request a snapshot, it goes through the process and gets information about all of the objects on the heap, and the API that Microsoft provide for us to do this is implemented as a COM component, meaning all of the activity this component does is going to use umanaged resources.

We should be freeing that memory once the results are collected and passed back to the main application through the pipe, though.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby mdgarrett » Thu Sep 01, 2011 4:47 pm

Thanks for the reply, and sorry for my slow reply on this issue. Do you know if this is a known bug then? Is this resolved in the latest release?

Can upload program, results of analysis, etc. to demonstrate error. It also grows much more rapidly for a windows GUI app than a console.
mdgarrett
 
Posts: 5
Joined: Thu Aug 11, 2011 8:43 pm

Postby Brian Donahue » Fri Sep 02, 2011 9:20 am

It's part of the design. Profiler has to store some objects in your process' memory space.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby mdgarrett » Fri Sep 02, 2011 12:20 pm

Ok, I understood that part, but then you mentinoed this, which through my understanding off:

We should be freeing that memory once the results are collected and passed back to the main application through the pipe, though.


Thought you meant that this allocation should eventually become free, which is something I've not seen.[/quote]
mdgarrett
 
Posts: 5
Joined: Thu Aug 11, 2011 8:43 pm


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 1 guest