Open haefele opened 11 months ago
In most cases, the application is out of memory.
Have same issue in net472 application, so many reports from different users, different os versions from win7 to win11.
OutOfMemoryException: 没有足够的内存继续执行程序。
StackTrace:
在 System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
在 System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
在 System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
在 System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
在 System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
One of the sample report, when this happen the memory status: Free system memory:10240MB Total System Memory:16269MB Current Process: WorkingSet:93MB PrivateMemory:275MB VirtualMemorySize:5380MB
So it maybe not released to shortage of memory.
@haefele Are you using any 3rd wpf library in your application?
Note that stack traces of OutOfMemoryException
s don't necessarily point to the problematic code.
At my company we had an OOM in our app with a similar stack trace as shown here. The actual problem was that we used an overload of the XmlSerializer
constructor which generates an in-memory assembly every time it is called.
@haefele Are you using any 3rd wpf library in your application?
Yes, we are making heavy use of DevExpress WPF controls.
Note that stack traces of
OutOfMemoryException
s don't necessarily point to the problematic code.At my company we had an OOM in our app with a similar stack trace as shown here. The actual problem was that we used an overload of the
XmlSerializer
constructor which generates an in-memory assembly every time it is called.
That's interesting. How did you figure that out in the end?
I still have the process-dumps at hand, and usually am pretty okay figuring stuff out like that, but I really don't see anything suspicious in those.
I received some more info from the customer. It seems like they experience that problem on just a single machine. Could it be hardware or driver related?
How did you figure that out in the end?
I'll spare you the boring details and the fact that it took us some weeks to open the crash dump in Visual Studio and just take a look at the Modules window 😅
I still have the process-dumps at hand, and usually am pretty okay figuring stuff out like that, but I really don't see anything suspicious in those.
You can try to analyze the dumps using the built-in tools in VS or try a memory profiler like dotMemory.
I had the same issue but it was on DUCE::ReleaseOnChannel
, I'm not sure what happened as I was leaving the application debugged in the background and then the IDE threw an error as soon as I focused on the MainWindow.
At that time, my computer was using 77% of the memory and my application was taking up ~358.5MB. Obviously there was plenty of free memory for the application to work. The same application when running before could sometimes use up to 1.2GB of memory when doing data collection.
When I took a memory snapshot, the most used things were GlyphRun, Hashtable, ResouceDictionary, RenderData,... while the data in my application model was negligible.
The application was running WPF on .NetFramework 4.7.2, the IDE was Visual Studio 2022 Professional 17.11.4
Description
One of our customers, is getting a weird
OutOfMemoryException
deep inside the framework code, even tho not much is happening in our app.I've found these two other issues that seem similar: #7378 #8031
Reproduction Steps
Sadly we can't reproduce the problem on any of our own machines.
But our customer is able to reliable reproduce the problem. We gathered some process-dumps during some crashes, and that's how we figured out everything we know so far.
We could maybe share those process-dumps with you.
Expected behavior
Not getting an OutOfMemoryException, the application should keep working as usual.
Actual behavior
The exception:
It looks like this problem arises when a tooltip pops up in the app. I receive the System.OutOfMemoryException within the Dispatcher.UnhandledException event, with the following stacktrace.
However, it also could be unrelated.
Regression?
We don't know if this is a recent problem or if it's always been there for the customer. Neither do we know if just a single machine or windows-user is affected by it.
But we can pretty confidently say, that the issue doesn't seem very common, as our app doesn't show this issue on thousands of other machines.
Known Workarounds
No response
Impact
Our app crashes, and with it all unsaved changes are lost.
Configuration
Other information
No response