VB.NET App "Out of memory"; use Memory Profiler?

Use this forum to discuss subjects that don't belong in the other forums.

Moderator: SciTech Software

VB.NET App "Out of memory"; use Memory Profiler?

Postby jahooper » Mon Jul 23, 2007 3:19 pm

In a VB.NET winforms app, some users are sporadically getting "Out of memory" exceptions. Example Stack Trace is below... Is this likely to be directly related to a .NET memory leak (system resources not disposed properly after use)?

As the errors do not occur in our dev and test environments, it appears that we could connect your profiler to our running prod app? BUT, we have 800+ prod users across 40+ sites! And we don't know where the next exceptions might occur... Maybe we could run the profiler at just a few of our higher volume sites... How would licensing work?

Given this info, is .NET Memory Profiler the right tool for my organization?

Application Domain: DMV.Select.Root.exe
Assembly Codebase: file:///C:/Program Files/VA DMV Select/DMV.Select.Root.exe
Assembly Full Name: DMV.Select.Root, Version=1.3.2725.18352, Culture=neutral, PublicKeyToken=null
Assembly Version: 1.3.2725.18352
Assembly Build Date: 6/18/2007 11:11:44 AM

Exception Source: System.Drawing
Exception Type: System.OutOfMemoryException
Exception Message: Out of memory.
Exception Target Site: FromHdcInternal

---- Stack Trace ----
System.Drawing.Graphics.FromHdcInternal(hdc As IntPtr)
DMV.Select.Root.exe: N 00102
System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(src As IntPtr, offsetX As Int32, offsetY As Int32, width As Int32, height As Int32)
DMV.Select.Root.exe: N 00570
System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(targetGraphics As Graphics, targetDC As IntPtr, targetBounds As Rectangle)
DMV.Select.Root.exe: N 00259
System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(target As IntPtr, targetBounds As Rectangle)
DMV.Select.Root.exe: N 00092
System.Windows.Forms.Control.WmPaint(m As Message&)
DMV.Select.Root.exe: N 00350
System.Windows.Forms.Control.WndProc(m As Message&)
DMV.Select.Root.exe: N 00656
System.Windows.Forms.ScrollableControl.WndProc(m As Message&)
DMV.Select.Root.exe: N 00053
System.Windows.Forms.ContainerControl.WndProc(m As Message&)
DMV.Select.Root.exe: N 00022
System.Windows.Forms.Form.WndProc(m As Message&)
DMV.Select.Root.exe: N 00638
Infragistics.Win.ToolTipFormEx.WndProc(m As Message&)
DMV.Select.Root.exe: N 00388
System.Windows.Forms.ControlNativeWindow.OnMessage(m As Message&)
DMV.Select.Root.exe: N 00010
System.Windows.Forms.ControlNativeWindow.WndProc(m As Message&)
DMV.Select.Root.exe: N 00187
System.Windows.Forms.NativeWindow.Callback(hWnd As IntPtr, msg As Int32, wparam As IntPtr, lparam As IntPtr)
DMV.Select.Root.exe: N 00047
Posts: 1
Joined: Mon Jul 23, 2007 3:03 pm

Postby Andreas Suurkuusk » Tue Jul 24, 2007 8:09 pm

Without further investigation, it is hard to know what causes the OutOfMemoryException in your example. It might be caused by a managed memory leak or a resource leak due to undisposed managed instances.

When the exception occurs on a production machine, you should be able to create a memory dump of the process. This memory dump can then be imported into .NET Memory Profiler on another machine. The memory dump will allow you to get information about all managed instances in the process. However, you will not be able to retrieve information about unmanaged resources using the memory dump (the resource tracker is only available when the profiled process is started from the profiler).

I don't think that running the application under the profiler at production machines is a good alternative. As you mention, you don't know on what machines the problem will occur, and the application will run significantly slower and consume more memory.

The license agreement allows you to install the software on one computer for each license you have acquired. Additionally, the main user of the computer is allowed to install and use the software on one additional computer, as long as only one copy is used at the time. The license agreement does allow you to reinstall it on new computers, as long as it is uninstalled on the old one first.

My recommendation to you is to investigate a memory dump file and see if you can get some inidication on where the problem resides. And then you can hopefully investigate it in more detail on a development system with .NET Memory Profiler installed. If you have a memory leak, you should be able to identify it on a development machine, before an OutOfMemoryException is thrown.
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
Posts: 957
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden

Re: VB.NET App "Out of memory"; use Memory Profiler?

Postby bobmorton » Wed Jan 19, 2011 9:31 am

Thanks. Problem solved.
Bob Morton
Makita Drill Review & stop barking blogger
Posts: 1
Joined: Wed Jan 19, 2011 9:25 am
Location: Akron, Colorado

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.

SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla

E-mail: mail@scitech.se

Telephone: +46-706868081