Tracking unidentified memory usage

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
jdixon
Posts: 2
Joined: Tue Dec 21, 2021 2:37 pm

Tracking unidentified memory usage

Post by jdixon » Tue Dec 21, 2021 4:37 pm

Hello, first I wanted to say that I did see your blog post here: https://memprofiler.com/articles/the-other-data-node
However, I am still having issues tracking down where this memory leak is going. We have a C# Windows service that utilizes RestSharp and Quartz to run tasks on an interval (for testing it is set to 1 minute intervals). We notice over time the memory grows and can grow to over 1GB in just a couple of days. We have examined all the code and made sure we are disposing of what has a dispose method and even set objects to null when we were finished.

Using WinDbg you can see the heap utilizing the memory but when I try to examine it, I only get messages like:
0000026592e107f0 0038 0038 [00] 0000026592e10800 00370 - (busy)
unknown!printable
Trying the various UsrPtr from pages of that list just gives me the same result of "unknown!printable".

Fast forward to now, I discovered the .NET memory profiler and really like the application but it is giving some of the same results. Debugging the application from Visual Studio I have noticed that all of the data goes into "Other Data -> <Unidentified>". My understanding is the Native Memory tab will not use the resource tracker (which I have enabled).

I am a little unclear about there the Types/Resource view I should be looking at to diagnose this issue further. The blog links to page "https://memprofiler.com/online-docs/typ ... lspage.htm" which gives a 404 error. I noticed there were from caveats such as not being able to attach to a process but I can't do this on the production machine since the application gives an unhandled exception when trying to install.

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

Re: Tracking unidentified memory usage

Post by Andreas Suurkuusk » Wed Dec 22, 2021 2:48 pm

As mentioned in the article, the native resources tracker requires that you start the profiled process from the profiler. This is the only way the profiler will be able to collect additional information about the resources, e.g. the creation call stack.

Do you have any more information about the exception you see when trying to install?
Best regards,

Andreas Suurkuusk
SciTech Software AB

jdixon
Posts: 2
Joined: Tue Dec 21, 2021 2:37 pm

Re: Tracking unidentified memory usage

Post by jdixon » Thu Dec 23, 2021 2:45 pm

I wasn't attaching to a process, I was using the visual studio plugin and running in debug mode with "Debug with Memory Profiler". I figured that would would make it work.

I downloaded the MSI and that installed but the exe throws:
Application: MemProfilerInstaller5_7_25.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException
at System.RuntimeTypeHandle.CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef)
at System.RuntimeType.CreateInstanceSlow(Boolean, Boolean, Boolean, System.Threading.StackCrawlMark ByRef)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean, Boolean, System.Threading.StackCrawlMark ByRef)
at System.Activator.CreateInstance(System.Type, Boolean)
at System.Activator.CreateInstance(System.Type)
at SciTech.Profiler.Installer.ViewModels.MemProfilerInstallerViewModel.UpdateDetectedFeatures()
at SciTech.Profiler.Installer.ViewModels.InstallerWizardViewModel.HandleDetectComplete()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at SciTech.Profiler.Installer.InstallerWizardApplication.Run()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
Specs:
* Virtual Machine (Hyper-V 2019 Host)
* Windows Server 2016 Standard
* .NET 2.0/3.5 feature installed

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

Re: Tracking unidentified memory usage

Post by Andreas Suurkuusk » Tue Dec 28, 2021 9:52 pm

Thanks for stack trace from the installer. Apparently there's an issue with the Visual Studio detection in the installer. We will fix that as soon as possible. Hopefully we can release a maintenance fix by tomorrow.

You can use "Debug with Memory Profiler" together with the native resources tracker. When you start profiling using "Debug with Memory Profiler" it will user the default session settings, so you need to enable the resources tracker using "Profiler->Options" (see screenshot).
EnableResourcesTracker.jpg
Best regards,

Andreas Suurkuusk
SciTech Software AB

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

Re: Tracking unidentified memory usage

Post by Andreas Suurkuusk » Wed Dec 29, 2021 8:06 pm

Now we have hopefully fixed the issue with the installer. Can you download the latest build from https://cdn.memprofiler.com/download/Me ... 5_7_26.exe and see if it works better?

We will probably release this version officially tomorrow.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 20 guests