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

Memory use: what should I expect while processing large image files? #4303

Open
dmitrizzle opened this issue Dec 21, 2024 · 2 comments
Open
Labels

Comments

@dmitrizzle
Copy link

I need help understanding what to expect in terms of memory usage.

For some reason, I thought that using streaming and Jemalloc (on Node Alpine-18) would let me make transformations to image files that are larger than available RAM. #179 appears to be proving me wrong. (?)

What should I expect in terms of memory usage for the following:

  • Download a large image file 250MB.
  • Convert the downloaded image into an uncompressed PNG. All the below pipelines except the last stream to PNG files.
  • Create a small copy of that file for analysis.
  • Split the large image file into 3 channels (R, G, B) and perform transformations on those channels individually (using linear).
  • Assemble transformed R, G, B channels into a complete image.
  • Convert the completed image to JPEG or another format based on user input.

My (Dockerised) app on Heroku needs about 2.5GB of RAM to safely complete the above tasks. Is this reasonable?

@lovell
Copy link
Owner

lovell commented Dec 22, 2024

Did you see the recomb operation? That should allow you to apply separate linear multiplications to 3 channels at once, avoiding splitting/joining channels.

@dmitrizzle
Copy link
Author

Will try that, thanks!
I should add that the memory use jumps before the process gets to channel splitting (so, if I were to comment that part out, memory usage would still be this high).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants