Open israelsucks opened 1 month ago
Not sure exactly where the leak occurs (whether in rumps or in the underlying pyobjc bridge), but to get around it you can modify menu items in-place rather than remake the whole menu each time, like so:
import rumps
import time
testinterval=0.1
class AwesomeStatusBarApp(rumps.App):
def __init__(self):
super(AwesomeStatusBarApp, self).__init__("myapp")
self.menu = [x for x in range(1000)]
@rumps.timer(testinterval)
def sayhi(self, _):
for (_, item) in self.menu.items():
item.title = f"time {time.time()}"
if __name__ == "__main__":
AwesomeStatusBarApp().run()
This hovers around ~35.0 MB on my machine.
Hello,
I've spotted my app which updates its menu regularly reaches multiple GB's of memory over time.
Here is an example code similar to my code's logic, which uses exaggerated values for quick demonstration purposes:
If you look at Activity Monitor, you'll see its memory grows indefinitely. I've also tried iterating over menu
keys()
anddel
eting them but didn't fix the leak.Am I doing something wrong or is it the rumps which leaks memory under the hood?