Open munishkhatri720 opened 2 months ago
Are you closing the editor after generating images ?
Yes, I am closing the editor after modifying the image. But my question is, why is the cache TTL set to 12 hours? I used easy_pil with FastAPI, which handles 22,000 images every day, but the API's RAM usage reached 7 GB in a single day. I think the load_image_async function is caching images for too long, which is causing the high RAM usage.
So, do you think removing cache is better so you can implement your own caching strategy?
Also load_image
loads the image from a link then opens it using Image.open()
you need to close this too after the usage of the image is done
editor = Editor()
img = await load_image_async(url)
editor.paste(img, ...)
img.close()
bytes = editor.image_bytes
editor.close()
Let me know if this strategy helps reducing ram usage, ultimately all the images that you open must be closed to improve performance
Does this will not increase memory usage of the application in which easy_pil is used ?
I have an api which builds musiccard every second and I noticed my vps memory usage touched 1gb in just few minutes