Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS Memory Leak? #45

Closed
ArguingMeadows opened this issue Mar 4, 2022 · 8 comments
Closed

MacOS Memory Leak? #45

ArguingMeadows opened this issue Mar 4, 2022 · 8 comments

Comments

@ArguingMeadows
Copy link

I keep running out of system memory since updating to Monterey 12.2.1 and Waifu2x 5.3.6 on my M1 Pro Macbook Pro with 16 GB of RAM and my Intel iMac with an Intel Core i9, Vega 48 GPU with 8 GB or HMB2 VRAM and 64 GB of RAM. I know Monterey has a memory leak issue that's been thrown around but it only happens to me using this specific app.

@imxieyi
Copy link
Owner

imxieyi commented Mar 4, 2022

Can you provide a description of what you were doing? For example processing images or videos, model configurations, etc.

@ArguingMeadows
Copy link
Author

I would try to upscale a video. I used to be able scale up to an hour-long video on any model with no problem. Now, the I'm lucky if I can upscale a video that is a little over a minute. Model doesn't seem to matter, it happens on both Real-ESRGAN and CUnet at the very least from my testing. Doesn't matter what type of video either. H.264, HEVC and ProRes export all cause the same issue.

@ArguingMeadows
Copy link
Author

Update: Testing it on the SCRNN Illustration model, it did not result in a memory leak on a video just over 90 seconds long.

@imxieyi
Copy link
Owner

imxieyi commented Mar 4, 2022

That's weird. I never had any issues regarding memory leak on any model. But I'm on 12.0.1. I'll update to the latest macOS to see if it happens to me as well.

@ArguingMeadows
Copy link
Author

I think it’s more specifically Monterey 12.2.1 causing the issue since I didn’t have it before the update, but it is strange that this app is the only one that triggers it. Thank you for looking into this.

@imxieyi
Copy link
Owner

imxieyi commented Mar 5, 2022

I updated to 12.2.1 and still didn't see any memory leaks in Xcode debugger. Then I noticed that in Activity Monitor the Real Mem was steadily growing while processing a video. It was not as bad as you described though. I tried to upscale a 90s video 1080p -> 4k with Real-ESRGAN and at the end it only grew to 2.70GB. A memory graph sample in Xcode didn't show anything leaking. And the memory usage reported by Xcode stayed at around 110MB during the whole process. I also tried to use Xcode profiler and still no luck.

It happens with SRCNN as well. It's just not leaking as fast.

I also tried CLI and unfortunately it had the exact same problem.

Therefore I believe it is an issue with macOS itself. The app already released its memory but for some reason the OS kept some of them unreleased. And existing tools provided by Xcode are not able to capture them. We may have to wait until the issue is fixed in macOS.

@ArguingMeadows
Copy link
Author

I was starting to think it's Monterey as well, but I figured I'd mention it. Thank you for looking into this. I'll send feedback to Apple.

@imxieyi
Copy link
Owner

imxieyi commented Mar 9, 2022

Today when I tested on my M1 MBA with a 90 sec video again the Real Mem behavior changed. It increased to 1.5GB during the first half of the process and stopped there. After the video processing was completed it quickly dropped to <100MB. Then I tried on my Intel Mac again with the exact same video and setup and unfortunately it still steadily increased to almost 3GB and didn't drop after the process was completed. Looks like this is a very janky issue that does not always reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants