monroewilliams / MatrixDownload

Releases of my Matrix screensaver.
237 stars 10 forks source link

Sonoma Memory Issue #15

Open Elijah-Dakota opened 1 year ago

Elijah-Dakota commented 1 year ago

Initially upgrading to Sonoma posed no issues and everything worked as it did on previous OS versions. Today I noticed on my MBP that Safari was experiencing graphical glitches and the GUI for safari would go black. I checked activity monitor and the screensaver service was using 20GB+ of RAM in my 64GB machine. Restarting fixed the issue however I do not know if their is a memory leak somewhere or it is an error on my end.

monroewilliams commented 1 year ago

I don't usually see the screensaver service running when the screensaver isn't currently active, so I'm not sure how this would happen. Are you using it as a desktop background or something?

monroewilliams commented 1 year ago

Oh, this is odd. It does appear that there's a "legacyScreenSaver (Wallpaper)" process running constantly, even when I'm not using it as a wallpaper, and it seems to have the currently selected (Matrix) screensaver loaded. Every time I invoke the actual screensaver and then dismiss it, the memory allocated to that process increases by a substantial amount, and the amount of CPU time it takes increases. This makes it seem like this process is adding more instances of my screensaver code each time the screensaver is invoked, and keeping them running forever.

I don't think there's any good reason Apple should have this running constantly, so this smells to me like a bug in their logic.

As a workaround, you should be able to use Activity Monitor to force-quit this process if you see it taking up a bunch of memory, instead of having to reboot. I'll look into what might be going on here as well.

Thanks for the report!

monroewilliams commented 1 year ago

It looks like all of Apple's included screensavers are now packaged as application extensions (.appex) that live in /System/Library/ExtensionKit/Extensions/. The extension point identifier they use (com.apple.screensaver) is not listed in /System/Library/ExtensionKit/ExtensionPoints/, although the Info.plist in ScreenSaver.framework does have a section describing it. It's not clear to me whether they support installing third-party screensavers packaged as application extensions, nor is it clear what code changes might be needed if I repackaged it that way.

Elijah-Dakota commented 1 year ago

That is odd, I’ll dig into it tomorrow and see if I can find anything that can be changed to alleviate it Sent from my iPhoneOn Oct 6, 2023, at 19:00, Monroe Williams @.***> wrote: It looks like all of Apple's included screensavers are now packaged as application extensions (.appex) that live in /System/Library/ExtensionKit/Extensions/. The extension point identifier they use (com.apple.screensaver) is not listed in /System/Library/ExtensionKit/ExtensionPoints/, although the Info.plist in ScreenSaver.framework does have a section describing it. It's not clear to me whether they support installing third-party screensavers packaged as application extensions, nor is it clear what code changes might be needed if I repackaged it that way.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

TheAnamoly3 commented 1 month ago

@monroewilliams Is there any update on this, please? The screensaver is incredible and brings me a lot of joy after just seeing Matrix 25th anniversary in theaters. However it's absolutely leaking memory like crazy in Sonoma. After running the screensaver legacyScreenSaver stays open until it eventually it eventually maxes out the system memory.

Thank you.