Welcome to the WPF feedback portal. We’re happy you’re here! If you have feedback on how to improve the WPF, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

I've added pdfviewer to my wpf app.

My system has 64gb of ram and a reasonably powerful cpu.

MS Windows 10.


If I load an 8mb file (appx 800 pages) -- whether via code or the Open menu of the viewer, and start clicking on the page Next nav button, I eventually get a System.OutOfMemoryException error.

When I get the error and then, while the error is still in break mode, and check used memory via the Windows tools, there is plenty of free RAM.


This is usually after around 80 pages. Most recently, it happened at page 98. It seldom errors out on the same page.

I've tried reloading and jumping to pg 98 and contining the page nexting from there and consistently after a few dozen pages, I'll get the error again.

8mb and 800 pages doesn't seem overly large.

Is there a workaround?

I've spent a couple hundred hours on this project and I can't imagine having to tell me client I have to start over with a different pdf viewer. They may fire me.

EDIT: I tried it again after a reboot with nothing else running and got the same error. This time at pg 76. Same file. 46GB free ram.

I'm in the version 24.2.9 of the library.

It prints from the viewer w/o error also.

The same file works just fine in Adobe Acrobat. I can quickly tap through all 800 pages w/o crashing it.

It even occurs on a 4.5mb file with just 200 pages. Most recently, that happened on page 78.


Here's the full error:

System.OutOfMemoryException

  HResult=0x8007000E

  Message=Insufficient memory to continue the execution of the program.

  Source=PresentationCore

  StackTrace:

   at System.Windows.Media.Composition.DUCE.Channel.SyncFlush() in System.Windows.Media.Composition\DUCE.cs:line 220

   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet) in System.Windows.Interop\HwndTarget.cs:line 1320

   at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam) in System.Windows.Interop\HwndTarget.cs:line 1214

   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam) in System.Windows.Interop\HwndTarget.cs:line 879

   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in System.Windows.Interop\HwndSource.cs:line 952

   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)


  HResult=0x8007000E

System.OutOfMemoryException

  Message=Exception of type 'System.OutOfMemoryException' was thrown.

  Source=WindowsBase

  StackTrace:

   at System.Windows.UncommonField`1.SetValue(DependencyObject instance, T value)

   at System.Windows.UIElement.OnCreateAutomationPeer() in System.Windows\UIElement.cs:line 7019

   at System.Windows.UIElement.CreateAutomationPeer() in System.Windows\UIElement.cs:line 7056

   at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) in System.Windows.Automation.Peers\UIElementAutomationPeer.cs:line 108

   at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) in System.Windows.Automation.Peers\UIElementAutomationPeer.cs:line 108

   at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) in System.Windows.Automation.Peers\UIElementAutomationPeer.cs:line 108

   at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) in System.Windows.Automation.Peers\UIElementAutomationPeer.cs:line 108

   at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) in System.Windows.Automation.Peers\UIElementAutomationPeer.cs:line 108

   at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) in System.Windows.Automation.Peers\UIElementAutomationPeer.cs:line 108

   at System.Windows.Automation.Peers.UIElementAutomationPeer.GetChildrenCore() in System.Windows.Automation.Peers\UIElementAutomationPeer.cs:line 73

   at System.Windows.Automation.Peers.AutomationPeer.EnsureChildren() in System.Windows.Automation.Peers\AutomationPeer.cs:line 1293

   at System.Windows.Automation.Peers.AutomationPeer.UpdateChildrenInternal(Int32 invalidateLimit) in System.Windows.Automation.Peers\AutomationPeer.cs:line 1641

   at System.Windows.Automation.Peers.AutomationPeer.UpdateChildren() in System.Windows.Automation.Peers\AutomationPeer.cs:line 1655

   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() in System.Windows.Automation.Peers\AutomationPeer.cs:line 1664

   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() in System.Windows.Automation.Peers\AutomationPeer.cs:line 1664

   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() in System.Windows.Automation.Peers\AutomationPeer.cs:line 1664

   at System.Windows.ContextLayoutManager.fireAutomationEvents() in System.Windows\ContextLayoutManager.cs:line 838

   at System.Windows.ContextLayoutManager.UpdateLayout() in System.Windows\ContextLayoutManager.cs:line 674

   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) in System.Windows\ContextLayoutManager.cs:line 716

   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() in System.Windows.Media\MediaContext.cs:line 1097

   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) in System.Windows.Media\MediaContext.cs:line 1063

   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) in System.Windows.Media\MediaContext.cs:line 985

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)

   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

--- End of stack trace from previous location ---

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Windows.Threading.DispatcherOperation.Invoke()

   at System.Windows.Threading.Dispatcher.ProcessQueue()

   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)

   at System.Windows.Threading.Dispatcher.Run()

   at System.Windows.Application.RunDispatcher(Object ignore)

   at System.Windows.Application.RunInternal(Window window)

   at System.Windows.Application.Run()

   at Krueger_1095cWpf.App.Main()


EDIT 2
I took a screenshot of the app memory usage on document load (via viewer toolbar, not code load) and again at the error. 1GB of usage should not be throwing an out of memory error on a 64GB machine with 16GB+ free. See attachment.

Any ideas?