Page 1 of 1

windows service leak in unmanaged code

Posted: Thu Aug 25, 2011 6:01 am
by Stefano
Hi
I've a windows service written in VB.NET (.NET 2.0) querying a quite old (and unsupported) VistaDB 2.0 database.
A memory leak is present somewhere in the unmanaged code I presume VistaDB uses (service Private Bytes keep growing, whereas the .CLR total heap size remains almost constant).
Would .NET Memory Profiler be useful in this case, or is this an "out of scope" situation?
thanks in advance
kind regards
stefano

p.s. if .NET Memory Profiler can help, is there any "how to" that I can use to start the leak quest?

Re: windows service leak in unmanaged code

Posted: Thu Aug 25, 2011 9:52 pm
by Andreas Suurkuusk
You can use the unmanaged resources tracker in .NET Memory Profiler to get information about the unmanaged memory leak. The resource tracker can be enabled on the "Decide on the unmanaged resource tracker" page in the "Profile service" wizard.

I also recommend that you make sure that the symbol file locations are correctly initialized using the Symbol File Locations page under Tools->Options. This will allow you to get more detailed native call stacks.

We don't have any "how to" guides related to unmanaged memory leaks, but locating unmanaged memory leaks is similar to managed memory leaks. Collect a few snapshots,e.g. before and after performing some action. Locate resources that have new instances, and investigate how they were created. If the allocation stack is available (i.e. if symbols are available) then you can hopefully find out why there's a memory leak.