Memory leak?
- I am trying to track down what I suspect to be a memory leak in my application. This is a WCF application that is hosted in a Windows Service. The symptoms are that over about 24 hours the app grows to over 2 Gb and then I start getting alot of "corrupt memory" exceptions from calls to Commerce Server (this app makes calls to CS).
I have tried using Rico Mariani's Performance Tidbits (http://blogs.msdn.com/ricom/archive/2004/12/10/279612.aspx) but I get to vadump and I get alot of errors of two kinds. One, 'Error: Private ShareCount > 1, 0x7ff29000 5' and the other under Stack Working Set Contributions '0 pages from stack for thread 00000000' Then if I ignore these errors and I do 'windbg -p xxxx' with the command !DumpHeap -stat I get so many objects listed it is hard to see the object that seems to be in the majority let alone which method initiated the allocation. If I strickly follow the blog I find that SOS seems to be limited in its latest incarnation and much of the functionality has been removed. All in all I am requesting some memory leak diagnostic help. Please.
Thank you.
Kevin
Answers
- Hello Kevin
I once listed some basic steps of memory leak diagnostics in this thread:
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/c6235e14-a204-4f7c-bf32-6e6e85274b80
Gregg Miskelly also shared many useful notes from debugging a managed memory leak:
http://blogs.msdn.com/greggm/archive/2009/10/29/notes-from-debugging-a-managed-memory-leak.aspx
Could you please check whether the skills introduced in these articles help you?
If you still have difficulty to analyze the memory leak, you can follow the article http://support.microsoft.com/default.aspx/kb/286350 to capture two dump files of the leaking application at an interval. 2 dumps are needed so as to do the comparison. After you get the dumps, please let me know your email address by sending a mail to jialge@microsoft.com. Then I will create a file transfer workspace where you can upload your dump file. The dumps will be kept confidential. I will dig into the dumps and try to figure out the cause for you.
Regards,
Jialiang Ge
MSDN Subscriber Support in Forum
If you have any feedback of our support, please contact msdnmg@microsoft.com.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byKevinBurton Monday, November 02, 2009 2:50 PM
All Replies
Hi Kevin,
Check these good links:
Inspect and Optimize Your Program's Memory Usage with the .NET Profiler API:
http://msdn.microsoft.com/en-us/magazine/cc188781.aspxANTS Memory Profiler Tool:
http://visualstudiogallery.msdn.microsoft.com/en-us/52599731-7904-4bac-8ab5-de37fa400cf5- Hello Kevin
I once listed some basic steps of memory leak diagnostics in this thread:
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/c6235e14-a204-4f7c-bf32-6e6e85274b80
Gregg Miskelly also shared many useful notes from debugging a managed memory leak:
http://blogs.msdn.com/greggm/archive/2009/10/29/notes-from-debugging-a-managed-memory-leak.aspx
Could you please check whether the skills introduced in these articles help you?
If you still have difficulty to analyze the memory leak, you can follow the article http://support.microsoft.com/default.aspx/kb/286350 to capture two dump files of the leaking application at an interval. 2 dumps are needed so as to do the comparison. After you get the dumps, please let me know your email address by sending a mail to jialge@microsoft.com. Then I will create a file transfer workspace where you can upload your dump file. The dumps will be kept confidential. I will dig into the dumps and try to figure out the cause for you.
Regards,
Jialiang Ge
MSDN Subscriber Support in Forum
If you have any feedback of our support, please contact msdnmg@microsoft.com.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked As Answer byKevinBurton Monday, November 02, 2009 2:50 PM
- Thank you this gives me alot to digest.
Kevin Thanks again.
Any idea why I get an exception when trying CLRProfiler with a Windows Service? I enter the service name (the service stops so I think the name is right) then I get (after it stops)
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at CLRProfiler.MainForm.ProfileService()
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
CLRProfiler
Assembly Version: 1.0.2621.19007
Win32 Version: 1.0.2621.19007
CodeBase: file:///C:/TEMP/CLRProfiler/Binaries/x64/CLRProfiler.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


