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

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

Open
iHzx opened this issue Mar 25, 2022 · 29 comments
Labels
bug Something isn't working

Comments

@iHzx
Copy link

iHzx commented Mar 25, 2022

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.

@pbond630
Copy link

pbond630 commented Apr 1, 2022

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.

@cemetary
Copy link

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

@p0deje
Copy link
Owner

p0deje commented Apr 11, 2022

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.

@pbond630
Copy link

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.

@divaltor
Copy link

divaltor commented Dec 1, 2022

What's the status of this issue?

@p0deje
Copy link
Owner

p0deje commented Dec 1, 2022

No progress at the moment.

@Laicure
Copy link

Laicure commented Mar 16, 2023

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.

@chunyang-wen
Copy link

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

@nicolaerario
Copy link

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

@avichou
Copy link

avichou commented Nov 1, 2023

it often gets dangerously close to 2gb...

@p0deje
Copy link
Owner

p0deje commented Nov 15, 2023

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.

o.mp4

@tony-swg
Copy link

image cring😭 1.2GB

@tony-swg
Copy link

image cring😭 1.2GB

image 3.8GB now

@p0deje
Copy link
Owner

p0deje commented Nov 24, 2023

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

@tony-swg
Copy link

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

yes, both

@oraoraroa12313
Copy link

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

@INikonI
Copy link

INikonI commented Dec 11, 2023

Same issue
image

@bombastiik
Copy link

image 4 GB...

@p0deje
Copy link
Owner

p0deje commented Jan 20, 2024

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.

@noahhhi
Copy link

noahhhi commented Jan 24, 2024

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.

@coopfidgets
Copy link

coopfidgets commented Feb 9, 2024

Has this memory leak been fixed yet?
image

Maccy's memory leak is draining my RAM!

@soko1
Copy link

soko1 commented Jun 1, 2024

I suggest a temporary solution - restart the program every hour using crontab.

Open a terminal, enter the command crontab -e (if you are afraid that you will not be able to exit Vim :D, then use the command EDITOR=nano crontab -e), then enter the line:

* 1 * * * killall Maccy && /Applications/Maccy.app/Contents/MacOS/Maccy &

save changes.

It should look like this:

$ crontab -l
* 1 * * * killall Maccy && /Applications/Maccy.app/Contents/MacOS/Maccy &

@mishra-aayush-work
Copy link

For me the RAM usage was ~12 GBs, Quitting didn't help.

So I deleted everything and reinstalled it.

@Pil0tXia
Copy link

Pil0tXia commented Aug 1, 2024

I appreciate this software and hope this issue can be resolved promptly. As this software has been developed and maintained by the author for a long term, very few people are familiar with this project besides the author. While waiting for contributions from the open source community may not be the most effective solution for a quick fix, I also hold hope that a kind soul might come forward to address this issue.

@Chen1Plus
Copy link

Is it tried to free some history from memory (and save it to disk) when the memory usage exceed a limit? If not, I think this can be a temporary solution.

And maybe it's possible to ask Microsoft that how win + v works when user copying lots of image.

@p0deje p0deje mentioned this issue Oct 2, 2024
Closed
2 tasks
@p0deje
Copy link
Owner

p0deje commented Oct 2, 2024

Folks, please share how things work for you on Maccy 2.0+

@MNeverOff
Copy link

Folks, please share how things work for you on Maccy 2.0+

I'd say it's definitely better, well done with the rewrite and thank you so much for all the efforts!
I'd still say that it's way over what I'd expect, and when restarting it falls down to ~50MB, so maybe not quite solved?

image

@Tyson1986
Copy link

Mine is the same
image

@kra-mo
Copy link

kra-mo commented Oct 18, 2024

A little more robust workaround than #384 (comment) that avoids killing Maccy while currently open:

https://gist.github.com/kra-mo/e404d594d3d1c18e4db37013c9bec694

Just put it in ~/Library/LaunchAgents ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests