Click here to Skip to main content
15,312,353 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
HI
I get this exception when i run the tool for more than 3 hours
i do have 16GB RAM , 64Bit OS Intel Core i7 4770 CPU and 150 GB HD





Application: PRO.LoadTest.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.OutOfMemoryException
   at System.Windows.Dependent..ctor(System.Windows.DependencyObject, System.Windows.DependencyProperty, System.Windows.Expression)
   at System.Windows.DependentList.Add(System.Windows.DependencyObject, System.Windows.DependencyProperty, System.Windows.Expression)
   at System.Windows.DependencyObject.UpdateSourceDependentLists(System.Windows.DependencyObject, System.Windows.DependencyProperty, System.Windows.DependencySource[], System.Windows.Expression, Boolean)
   at System.Windows.DependencyObject.ChangeExpressionSources(System.Windows.Expression, System.Windows.DependencyObject, System.Windows.DependencyProperty, System.Windows.DependencySource[])
   at System.Windows.Expression.ChangeSources(System.Windows.DependencyObject, System.Windows.DependencyProperty, System.Windows.DependencySource[])
   at System.Windows.Data.BindingExpressionBase.ChangeSources(System.Windows.DependencyObject, System.Windows.DependencyProperty, MS.Internal.Data.WeakDependencySource[])
   at System.Windows.Data.BindingExpressionBase.ChangeSources(MS.Internal.Data.WeakDependencySource[])
   at System.Windows.Data.BindingExpression.ChangeWorkerSources(MS.Internal.Data.WeakDependencySource[], Int32)
   at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt)
   at System.Windows.Data.BindingExpression.AttachOverride(System.Windows.DependencyObject, System.Windows.DependencyProperty)
   at System.Windows.Data.BindingExpressionBase.OnAttach(System.Windows.DependencyObject, System.Windows.DependencyProperty)
   at System.Windows.StyleHelper.GetInstanceValue(System.Windows.UncommonField`1<System.Collections.Specialized.HybridDictionary[]>, System.Windows.DependencyObject, System.Windows.FrameworkElement, System.Windows.FrameworkContentElement, Int32, System.Windows.DependencyProperty, Int32, System.Windows.EffectiveValueEntry ByRef)
   at System.Windows.StyleHelper.GetChildValueHelper(System.Windows.UncommonField`1<System.Collections.Specialized.HybridDictionary[]>, MS.Utility.ItemStructList`1<System.Windows.ChildValueLookup> ByRef, System.Windows.DependencyProperty, System.Windows.DependencyObject, MS.Internal.FrameworkObject, Int32, Boolean, System.Windows.EffectiveValueEntry ByRef, System.Windows.ValueLookupType ByRef, System.Windows.FrameworkElementFactory)
   at System.Windows.StyleHelper.GetChildValue(System.Windows.UncommonField`1<System.Collections.Specialized.HybridDictionary[]>, System.Windows.DependencyObject, Int32, MS.Internal.FrameworkObject, System.Windows.DependencyProperty, MS.Utility.FrugalStructList`1<System.Windows.ChildRecord> ByRef, System.Windows.EffectiveValueEntry ByRef, System.Windows.ValueLookupType ByRef, System.Windows.FrameworkElementFactory)
   at System.Windows.StyleHelper.GetValueFromTemplatedParent(System.Windows.DependencyObject, Int32, MS.Internal.FrameworkObject, System.Windows.DependencyProperty, MS.Utility.FrugalStructList`1<System.Windows.ChildRecord> ByRef, System.Windows.FrameworkElementFactory, System.Windows.EffectiveValueEntry ByRef)
   at System.Windows.StyleHelper.ApplyTemplatedParentValue(System.Windows.DependencyObject, MS.Internal.FrameworkObject, Int32, MS.Utility.FrugalStructList`1<System.Windows.ChildRecord> ByRef, System.Windows.DependencyProperty, System.Windows.FrameworkElementFactory)
   at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(System.Windows.DependencyObject, MS.Internal.FrameworkObject, Int32, MS.Utility.FrugalStructList`1<System.Windows.ChildRecord> ByRef, Boolean, System.Windows.FrameworkElementFactory)
   at System.Windows.FrameworkTemplate.InvalidatePropertiesOnTemplate(System.Windows.DependencyObject, System.Object)
   at System.Windows.FrameworkTemplate.HandleBeforeProperties(System.Object, System.Windows.DependencyObject ByRef, System.Windows.DependencyObject, System.Windows.FrameworkElement, System.Windows.Markup.INameScope)
   at System.Windows.FrameworkTemplate+<>c__DisplayClass45_0.<LoadOptimizedTemplateContent>b__2(System.Object, System.Xaml.XamlObjectEventArgs)
   at System.Xaml.XamlObjectWriter.OnBeforeProperties(System.Object)
   at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(MS.Internal.Xaml.Context.ObjectWriterContext)
   at System.Xaml.XamlObjectWriter.WriteEndObject()
   at System.Xaml.XamlWriter.WriteNode(System.Xaml.XamlReader)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlReader, System.Xaml.XamlObjectWriter)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlObjectWriter)
   at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(System.Windows.DependencyObject, System.Windows.Markup.IComponentConnector, System.Windows.Markup.IStyleConnector, System.Collections.Generic.List`1<System.Windows.DependencyObject>, System.Windows.UncommonField`1<System.Collections.Hashtable>)
   at System.Windows.FrameworkTemplate.LoadContent(System.Windows.DependencyObject, System.Collections.Generic.List`1<System.Windows.DependencyObject>)
   at System.Windows.StyleHelper.ApplyTemplateContent(System.Windows.UncommonField`1<System.Collections.Specialized.HybridDictionary[]>, System.Windows.DependencyObject, System.Windows.FrameworkElementFactory, Int32, System.Collections.Specialized.HybridDictionary, System.Windows.FrameworkTemplate)
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(System.Windows.UncommonField`1<System.Collections.Specialized.HybridDictionary[]>, System.Windows.FrameworkElement)
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(System.Windows.Controls.Primitives.IItemContainerGenerator ByRef, System.Windows.Controls.Primitives.IContainItemStorage ByRef, System.Windows.Controls.Primitives.IContainItemStorage ByRef, System.Object ByRef, Boolean ByRef, Double ByRef, Double ByRef, Boolean ByRef, Boolean ByRef, System.Collections.IList ByRef, System.Object ByRef, System.Collections.IList ByRef, Int32 ByRef, Boolean ByRef, Boolean ByRef, System.Windows.Size ByRef, System.Windows.Rect ByRef, System.Windows.Controls.VirtualizationCacheLength ByRef, System.Windows.Controls.VirtualizationCacheLengthUnit ByRef, Int64 ByRef, Boolean ByRef, Double ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, Boolean ByRef, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean ByRef, Boolean ByRef)
   at System.Windows.Controls.VirtualizingStackPanel.MeasureOverrideImpl(System.Windows.Size, System.Nullable`1<Double> ByRef, System.Collections.Generic.List`1<Double> ByRef, System.Nullable`1<Double> ByRef, Boolean)
   at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement, System.Windows.Size)
   at System.Windows.Controls.ItemsPresenter.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Border.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Control.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement, System.Windows.Size)
   at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Grid.MeasureCell(Int32, Boolean)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32, System.Windows.Size, Boolean, Boolean, Boolean ByRef)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32, System.Windows.Size, Boolean, Boolean)
   at System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.ScrollViewer.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement, System.Windows.Size)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Grid.MeasureCell(Int32, Boolean)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32, System.Windows.Size, Boolean, Boolean, Boolean ByRef)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32, System.Windows.Size, Boolean, Boolean)
   at System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Control.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Grid.MeasureCell(Int32, Boolean)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32, System.Windows.Size, Boolean, Boolean, Boolean ByRef)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32, System.Windows.Size, Boolean, Boolean)
   at System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Border.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement, System.Windows.Size)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(System.Windows.Controls.Primitives.IItemContainerGenerator ByRef, System.Windows.Controls.Primitives.IContainItemStorage ByRef, System.Windows.Controls.Primitives.IContainItemStorage ByRef, System.Object ByRef, Boolean ByRef, Double ByRef, Double ByRef, Boolean ByRef, Boolean ByRef, System.Collections.IList ByRef, System.Object ByRef, System.Collections.IList ByRef, Int32 ByRef, Boolean ByRef, Boolean ByRef, System.Windows.Size ByRef, System.Windows.Rect ByRef, System.Windows.Controls.VirtualizationCacheLength ByRef, System.Windows.Controls.VirtualizationCacheLengthUnit ByRef, Int64 ByRef, Boolean ByRef, Double ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, System.Windows.Size ByRef, Boolean ByRef, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean ByRef, Boolean ByRef)
   at System.Windows.Controls.VirtualizingStackPanel.MeasureOverrideImpl(System.Windows.Size, System.Nullable`1<Double> ByRef, System.Collections.Generic.List`1<Double> ByRef, System.Nullable`1<Double> ByRef, Boolean)
   at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement, System.Windows.Size)
   at System.Windows.Controls.ItemsPresenter.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Border.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.Controls.Control.MeasureOverride(System.Windows.Size)
   at System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
   at System.Windows.UIElement.Measure(System.Windows.Size)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)
   at System.Windows.Media.MediaContext+InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)
   at System.Windows.Media.MediaContext.RenderMessageHandler(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.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 System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run(System.Windows.Window)
   at System.Windows.Application.Run()


What I have tried:

i tried adding Garbage collection
Posted
Updated 17-Dec-21 1:48am
Comments
CHill60 17-Dec-21 5:29am
   
You need to put logging into your secret code.
Really - how can we help you without any information about "the tool"
Chris Copeland 17-Dec-21 5:46am
   
It sounds like you have a memory leak in your code somewhere. A memory leak is when you're loading a resource which consumes memory, but you're not adequately disposing of the resource when it's no longer needed. This winds up consuming more and more memory, so you'll need to run some diagnostics to work out what object(s) are the problem.

Analyze memory usage (you can change your VS version to match)
Dave Kreskowiak 17-Dec-21 10:53am
   
This may also have nothing to do with memory. You can get this exception if you are doing GDI work with bad parameters, not freeing GDI objects properly, or otherwise exhausting the Windows handle pool.

Open up Task Manager, click on the Details tab, right-click a column header and pick "Select columns". Enable "Handles", "User objects", and "GDI objects". Click OK. Leave Task Manager open.

Go run your app, then go back to Task Manager and find it in the list. Over time, watch values for your app. If they continue to climb all the way to the scene of the crash, there's your hint of where the problem(s) are in your code.

1 solution

At the app.config, add the following:

XML
<configuration>
  <runtime>
    <gcAllowVeryLargeObjects enabled="true" />
  </runtime>
</configuration>
Read more about "gcAllowVeryLargeObjects - Microsoft .NET Documentation"

and em... yupe, as Dave Kreskowiak mentioned, this could potentially might not fix the problem. As the documentation said, on 64-bit platforms, this enables arrays (or objects) that are greater than 2 gigabytes (GB) in total size.

So it lifted the limit to certain larger extent.

Well :D if the operation can always finished with this setup, then this can at least considered as your temporary fix :)
   
v4
Comments
Dave Kreskowiak 17-Dec-21 10:44am
   
That's not a fix. That just delays the inevitable.

Also, OutOfMemory exceptions can also be thrown even though the machine doesn't run out of memory. They can also be thrown by buggy GDI code, or otherwise exhausts the Windows handle pool.
adriancs 17-Dec-21 23:51pm
   
Yupe, this is potentially not a fix. But if the operation can always finished with this setup. Then it can be considered as a temporary fix :) At least the whole thing can move on at the moment :D
Dave Kreskowiak 17-Dec-21 23:57pm
   
Only IF it's an actual problem with memory. More often than not, in the forums at least, it's because of GDI or handle problems, not memory.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900