lovell / lovell/sharp

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

Open
#4,303 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source file or test; start by reviewing the listed processing pipeline and referenced issue #179. Done means documenting expected memory usage for each stage and explaining whether roughly 2.5GB is reasonable for the described Node/Docker workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, javascript, nodejs
Domain
documentation, performance
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.