Application is leaking Virtual Memory

Memory profiling for .NET developers

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

Application is leaking Virtual Memory

Postby swisnieski » Mon Jul 15, 2013 2:29 pm

My application is leaking virtual memory. When running over the weekend, on Windows XP, the Task Manager shows the VM Size of the app to be growing. How do I find this type of leak ?
swisnieski
 
Posts: 1
Joined: Mon Jul 15, 2013 2:27 pm

Postby davecove » Tue Jul 16, 2013 6:28 am

Please excuse the 'me too me too', but it just so happens I am having the exact same issue right now.

ANTS shows that the Private Bytes, Page File Bytes, and Virtual Bytes are all increasing at the exact same slope, but the Working Set and Bytes in all Heaps are stable.

Private Bytes and Page File Bytes are superimposed on each other with Virtual Bytes somewhat higher, but again, on the exact same slope.

Can someone name the beastie I am hunting for?

Thank you for your time,
Dave
davecove
 
Posts: 2
Joined: Tue Jul 16, 2013 6:17 am
Location: United States

Postby Chris.Morter » Wed Jul 17, 2013 5:29 pm

Swisnieski, is the usage of private bytes also increasing at the same time? If not then it is likely that the problem lies in unmanaged code because the CLR will ensure that only the necessary amount of virtual memory is used for .NET code. (If yes then see my reply to davecove below)

In C++ this sort of problem can happen if you use VirtualAlloc with the MEM_RESERVE parameter to reserve memory but then don't actually commit the memory later by calling VirtualAlloc with the MEM_COMMIT parameter. Memory that has been reserved buy not committed will be counted as virtual memory, but not towards private bytes, only once the memory is committed will it count towards private bytes. So a good place to start would be looking for calls to VirtualAlloc with the MEM_RESERVE parameter, without matched calls to MEM_COMMIT (or the equivalent functions in whichever unmanaged language you may be using).

Davecove, it sounds like you also have some form of unmanaged memory leak since the memory usage of the CLR heaps is stable. I think the fact that the virtual memory usage is increasing at the same rate and the other counters suggests you have a normal memory leak and the increase in virtual memory is just coincidental.

Unfortunately AMP 7 has little support for profiling unmanaged memory but we are hoping to ship a beta of AMP 8 within the next week which supports unmanaged profiling, so hopefully that will be able to help you pin down these issues.
Chris.Morter
 
Posts: 2
Joined: Wed Jul 17, 2013 4:26 pm

Postby davecove » Wed Jul 17, 2013 5:32 pm

Do I have to apply for the beta?

Dave
davecove
 
Posts: 2
Joined: Tue Jul 16, 2013 6:17 am
Location: United States

ANTS Memory Profiler Beta

Postby Adam Parker » Thu Jul 18, 2013 9:15 am

Hi Dave - You can sign up for the beta program here:

http://www.red-gate.com/labs/ants-memory-profiler/

Once you're signed up we'll get a beta build out to you. Any feedback you might have on the beta would be very welcome!
Adam Parker
 
Posts: 1
Joined: Thu Jul 18, 2013 9:10 am


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 1 guest