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

ImageMagick cache is exhausted before gc is triggered #352

Open
DarwinAwardWinner opened this issue Jul 16, 2022 · 1 comment
Open

ImageMagick cache is exhausted before gc is triggered #352

DarwinAwardWinner opened this issue Jul 16, 2022 · 1 comment

Comments

@DarwinAwardWinner
Copy link

I have a script in which I'm running magick::image_read on a large number of images in sequence and then immediately discarding the result (the objective is just to verify that it's a valid image that can be read by magick). However, even though each result is discarded, I'm still getting "cache resources exhausted" after a while. I determined that running gc() every 100 or so images seems to prevent this error, so my assumption is that ImageMagick's cache is filling up with images that are no longer referenced but have not yet been garbage collected. Obviously, manually triggering gc every N iterations is a workaround, not a true fix. Is there any way to fix this a bit more elegantly? For example, could image_read check for this error and then trigger gc and try one more time before throwing the error for real?

@Liripo
Copy link

Liripo commented Oct 21, 2022

I also had this problem with large pixel images in a loop and had to call gc manually myself

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