❔ Sudden OutOfMemoryException due to OS change?
Let's imagine a WinForms .NET Framework 4.8 app is running on Win10 just fine, but under Win11 it suddenly causes OutOfMemoryExceptions due to exceeding the handle limit. Do you guys have a clue what could be the problem?
15 Replies
No, would need a stack trace or similar
There are several stack traces with different causes
for example
Is the memory usage actually exploding?
Gradually, but it crashes only under win11
Yeah, we have to figure out if the app is the issue or win11
Because it is often times the app itself
Are you loading fonts/images or similar?
Some custom listviews were made by people before me and those are loading a metric ton of icons. Other than that, images are rare and we only use default fonts
You could check the code or use a memory profiler to check if there is unreleased memory hiding somewhere
Is the app actually using the whole memory of the system btw? (before it crashes)
I thought as much. It was just odd that only Win11 causes that problem it doesnt
Interesting
Might be that the app always had this issue but only win11 is revealing it. Hard to tell
Is the app using a lot of memory? In general
Not really. roughly 70 MB at most.
And that's a pretty high estimation
I am pretty sure the app always had a problem with GC and uncollected handles
You mentioned that the app is loading many icons
Check if memory handling is fine there
static code analysis might help too
Idk if you use Rider or similiar
I'll do that thanks
You are welcome!
You can try to take memory dump to analyze if there is a memory leak on some operation, It was easy to take from web servers but I am not sure how to do that for desktop app, probably easier but should search
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.