Memory profiler causes an OutOfMemoryException
tony
Posts: 3
I've just used the memory profiler for the first time since upgrading to .Net 2.0.
I have an application that works fine on its own, in debug, and with the performance profiler.
I try to run the memory profiler and I get an OutOfMemoryException. This happens while trying to do some drawing in the initial construction of the main form.
I managed to get a memory snapshot when the exception is thrown and very little memory is being used at the time!
I have 1.0, 1.1 and 2.0 installed with Ants Profiler 2.6
System.OutOfMemoryException: Out of memory.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
at System.Drawing.Bitmap.MakeTransparent(Color transparentColor)
at System.Drawing.Bitmap.MakeTransparent()
at DevExpress.XtraBars.BarAndDockingController.InitBitmaps()
at DevExpress.XtraBars.BarAndDockingController..ctor()
at DevExpress.XtraBars.BarAndDockingController.get_Default()
at DevExpress.XtraBars.BarManager.GetController()
at DevExpress.XtraBars.BarManager.get_PaintStyle()
at DevExpress.XtraBars.Utils.BarManagerHelpers.get_PaintStyle()
at DevExpress.XtraBars.Utils.BarManagerHelpers.CreateLink(BarItemLinkReadOnlyCollection links, BarItem item, Object linkedObject)
at DevExpress.XtraBars.BarItem.CreateLink(BarItemLinkReadOnlyCollection links, Object linkedObject)
at DevExpress.XtraBars.BarItemLinkCollection.CreateLink(BarItem item)
at DevExpress.XtraBars.BarItemLinkCollection.Add(BarItem item, LinkPersistInfo info)
at DevExpress.XtraBars.BarItemLinkCollection.Add(BarItem item)
at DevExpress.XtraBars.BarLinkContainerItem.AddItem(BarItem item)
at DevExpress.XtraBars.InternalItems.BarSystemMenuItem..ctor(BarManager barManager)
at DevExpress.XtraBars.Utils.BarMdiHelper.Init()
at DevExpress.XtraBars.BarManager..ctor()
at Nexus.Storm.Forms.Modules.MainModuleForm.InitializeComponent()
at Nexus.Storm.Forms.Modules.MainModuleForm..ctor(Boolean loginRequired)
at Nexus.Storm.Forms.GruntBM.APG.Program.Main()
I have an application that works fine on its own, in debug, and with the performance profiler.
I try to run the memory profiler and I get an OutOfMemoryException. This happens while trying to do some drawing in the initial construction of the main form.
I managed to get a memory snapshot when the exception is thrown and very little memory is being used at the time!
I have 1.0, 1.1 and 2.0 installed with Ants Profiler 2.6
System.OutOfMemoryException: Out of memory.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
at System.Drawing.Bitmap.MakeTransparent(Color transparentColor)
at System.Drawing.Bitmap.MakeTransparent()
at DevExpress.XtraBars.BarAndDockingController.InitBitmaps()
at DevExpress.XtraBars.BarAndDockingController..ctor()
at DevExpress.XtraBars.BarAndDockingController.get_Default()
at DevExpress.XtraBars.BarManager.GetController()
at DevExpress.XtraBars.BarManager.get_PaintStyle()
at DevExpress.XtraBars.Utils.BarManagerHelpers.get_PaintStyle()
at DevExpress.XtraBars.Utils.BarManagerHelpers.CreateLink(BarItemLinkReadOnlyCollection links, BarItem item, Object linkedObject)
at DevExpress.XtraBars.BarItem.CreateLink(BarItemLinkReadOnlyCollection links, Object linkedObject)
at DevExpress.XtraBars.BarItemLinkCollection.CreateLink(BarItem item)
at DevExpress.XtraBars.BarItemLinkCollection.Add(BarItem item, LinkPersistInfo info)
at DevExpress.XtraBars.BarItemLinkCollection.Add(BarItem item)
at DevExpress.XtraBars.BarLinkContainerItem.AddItem(BarItem item)
at DevExpress.XtraBars.InternalItems.BarSystemMenuItem..ctor(BarManager barManager)
at DevExpress.XtraBars.Utils.BarMdiHelper.Init()
at DevExpress.XtraBars.BarManager..ctor()
at Nexus.Storm.Forms.Modules.MainModuleForm.InitializeComponent()
at Nexus.Storm.Forms.Modules.MainModuleForm..ctor(Boolean loginRequired)
at Nexus.Storm.Forms.GruntBM.APG.Program.Main()
Comments
I find it odd that it happens only in the memory profiler. I can advise enabling the logging in ANTS Profiler, which will create some log files that report profiler's memory usage. To do this, create a 'logs' subfolder in the ANTS Profiler program folder and restart the ANTS Profiler Service. At the next profiling session, three logs will be created. The corelog.txt will show some things about how much free memory is available to ANTS Profiler.
PhysMemInUse: 980 (Mb), VirtMemInUse: 150 (Mb), PhysMemAvail: 41 (Mb) - EndGarbageCollection (start)
this is the last memory log before the error. After the error the profiler has no problem using more memory up in creating the final snapshot.
It seems the profiler is making the Drawing routine think it has no memory!
Specifically, when I take a snapshot, memory utilization of RedGat.Profiler.UI.exe balloons from about 16 meg, to 300 meg.
Attempting to save the results of the snapshot then triggers the error (System.OutOfMemoryException in RedGate.Profiler.UI.exe). After clicking on the Save toolbar button, and specifying a file name, I can watch the memory utilization continue to go up and up (CPU too). After a minute or two, ANTS craps out. At this point the profiler UI is using 300-400 meg of memory, and > 800 meg of Virtual memory.
I get asked if I want to debug using the JIT debugger...whether I do or not, my ANTS profiling is done (the UI exe crashes regardless).
I'm trying to test an ASP.Net app (built w/VS 2003), on a system w/1 meg of RAM.
The problem is highly reproducible.
The UILogs.txt file has nothing to offer...here's all that it contains:
6/19/2006 2:45:21 PM ProfilingSession.StartProfiler
6/19/2006 2:48:37 PM ProfilingSession.GetProfilerResults
Note: the application I'm testing runs fine on its own.
Here's the resutl from the MessageBox you display:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
Server stack trace:
at _8._1()
at _10._1(_8 )
at _10._1(Byte[] )
at RedGate.Profiler.Engine.ProfilingSession._3()
at RedGate.Profiler.Engine.ProfilingSession.GetProfilerResults()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at _3._1.EndInvoke(IAsyncResult result)
at _3._3(IAsyncResult )