Open AkazaRenn opened 1 year ago
Hi, could you attach /bugreport? Thanks
Hi there!
We need a bit more information to really debug this issue. Can you add a "Report Bug" zip file here? You right click on our system tray icon and just go to report bug. Then drag the zipfile from your desktop onto the GitHub comment box in this issue. Thanks!
Hi, could you attach /bugreport? Thanks
Sorry for the late reply, here's the log PowerToysReport_2023-04-23-18-49-19.zip
@TheJoeFin Any ideas here? I can reproduce this (although in my case is not ~700MB, but ~300MB). So, triggering TextExtractor and just closing it consumes some memory and stays like that.
I have found a similar issue in Text Grab. I implemented a Stream Wrapper and called the Garbage Collector directly. This didn't solve the issue entirely, but it is the recommended mitigation. While working on this issue I have found several discussions that this is a bug in WPF. Apparently MemoryStream does not garbage collect quickly. I have also found with sufficient memory pressure, and/or time the memory is released.
Let's keep this issue open to track implementing the mitigations, or other fixes anyone else recommends.
@stefansjfw I have used the WrappingStream
around the MemoryStreams
here in my Fork, Can you see if the overuse of memory condition is improved for you? I am open to other ideas of how to release the memory once the OCR is done.
CC @jaimecbernardo
Think we may need to force a GC or something. I wouldn't say it is a leak but it lingers.
I do call GC.Collect();
after the OCR occurs. This does little to fix the issue.
Is this what you thought we should try or was there something else?
we should look at the profiling tools here, something is being kept in memory and i think it is the img some how
I'm still having this issue in 0.72. Memory stays around 425 MB after using the tool PowerToysReport_2023-08-01-18-36-25.zip
@XenoPanther this is still a known issue, I am looking for a reliable way to force the system to GC the image.
@lindexi you have done some work with Image GC issues in WPF. Any chance you would take a look at this issue and see if there are any improvements to be made here?
I have tried this fix with no meaningful reduction in memory:
oldImage.Source = null;
oldImage.UpdateLayout();
Microsoft PowerToys version
0.69.0
Installation method
PowerToys auto-update
Running as admin
No
Area(s) with issue?
TextExtractor
Steps to reproduce
✔️ Expected Behavior
Minimize the memory consumption at least when it is inactive.
❌ Actual Behavior
It eats about 700 MB of memory even when IDLE, this is way too much, especially when it isn't even doing anything.
Other Software
No response