Maccy icon indicating copy to clipboard operation
Maccy copied to clipboard

Maccy After being used in the background for many times, the memory occupation increases linearly

Open iHzx opened this issue 2 years ago • 29 comments

Operating environment

  • Device: MacBook Pro 14`2021
  • macOS: Monterey 12.3
  • Maccy Version: 0.22.2

Describe the problem

After running Maccy for a long time and using it for many times, the memory occupation of the application will gradually increase (it seems to grow linearly and there is no sign of release). It can be recovered after restarting the application. I hope the author can fix this problem, thank you.

iHzx avatar Mar 25 '22 01:03 iHzx

Device: MacBook Pro 14`2021 macOS: Monterey 12.3.1 Maccy Version: 0.22.2

I have this same issue; when Maccy starts on my machine, it uses 24.9MB ram. After some time (several days), ram usage goes up to 350-500MB. Clearing the history doesn't reclaim any ram; closing and restarting Maccy does.

There's clearly a memory leak going on somewhere.

pbond630 avatar Apr 01 '22 12:04 pbond630

Device: MacBook Air (M1) macOS: Monterey 12.3.1. Maccy Version: 0.22.2

In my case Maccy takes up 1.38 GB.

Captura de Pantalla 2022-04-10 a la(s) 18 33 03

cemetary avatar Apr 11 '22 00:04 cemetary

The way Maccy uses Core Data could probably be improved to avoid memory bloat - right now every new copy is kept in-memory so if you copy large images (for example) - it can increase over time. I need to see if there is a way to make Core Data work in a different way by offloading unused items from memory.

p0deje avatar Apr 11 '22 15:04 p0deje

Alex thx for this.

From the behaviour I've seen on my machine, it appears that references even to deleted items are being retained. The memory usage remains the same even after deleting all items by doing a 'Clear'. Shutting down & restarting Maccy is the only way to reclaim the memory.

pbond630 avatar Apr 11 '22 19:04 pbond630

What's the status of this issue?

divaltor avatar Dec 01 '22 20:12 divaltor

No progress at the moment.

p0deje avatar Dec 01 '22 21:12 p0deje

Is it the same how Microsoft Windows store (Windows+V) clipboard items, via memory?

I'm thinking if there should be an option to store locally or via memory.

Laicure avatar Mar 16 '23 12:03 Laicure

Maybe users have set a large history size? And a lot of images copied.(Just random guess)

chunyang-wen avatar Mar 21 '23 15:03 chunyang-wen

Maybe users have set a large history size? And a lot of images copied.(Just random guess)

It's not the case: I can reproduce with small text entries also. Just wait some time and the memory increase progressively

nicolaerario avatar May 14 '23 11:05 nicolaerario

it often gets dangerously close to 2gb...

avichou avatar Nov 01 '23 19:11 avichou

I've been looking into this issue a few times already and I don't know what can be improved at the moment. Here is a simple video showing that Maccy keeps text/images in memory but offloads at least a portion of it whenever it's closed.

  1. Start with clean Maccy. ~36MB
  2. Copy long text. ~41MB
  3. Copy screenshot. ~120MB when Maccy is visible, ~80MB when closed

If somebody understands Core Data and ways to lower memory consumption, I'd be happy to implement the recommendations, but I don't know what to do with this.

https://github.com/p0deje/Maccy/assets/665846/37bca9b4-9521-455d-87c7-02efa633d499

p0deje avatar Nov 15 '23 18:11 p0deje

image cring😭 1.2GB

tony-swg avatar Nov 22 '23 08:11 tony-swg

image cring😭 1.2GB

image 3.8GB now

tony-swg avatar Nov 24 '23 02:11 tony-swg

@tony-swg Do you copy lots of images or just text?

p0deje avatar Nov 24 '23 18:11 p0deje

@tony-swg Do you copy lots of images or just text?

yes, both

tony-swg avatar Nov 27 '23 06:11 tony-swg

After updating my system to Sonoma and Maccy to latest version, with each opening (command shift c) the memory usage increases by around 300kb

oraoraroa12313 avatar Dec 02 '23 21:12 oraoraroa12313

Same issue image

INikonI avatar Dec 11 '23 19:12 INikonI

image 4 GB...

bombastiik avatar Jan 20 '24 12:01 bombastiik

Folks, I get it - there is no need to post screenshots of RAM usage. It would be more helpful if someone would actually suggest ways to reduce the memory overhead or, ideally, send a PR.

p0deje avatar Jan 20 '24 19:01 p0deje

Folks, I get it - there is no need to post screenshots of RAM usage. It would be more helpful if someone would actually suggest ways to reduce the memory overhead or, ideally, send a PR.

I have no idea what cause this problem. But I suggest you could publish a build with regular relaunch the main program for quick fix.

noahhhi avatar Jan 24 '24 02:01 noahhhi

Has this memory leak been fixed yet? image

Maccy's memory leak is draining my RAM!

coopfidgets avatar Feb 09 '24 10:02 coopfidgets