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

Consuming a lot of memory while processing images #2407

Closed
Artur-Frank opened this issue Oct 11, 2020 · 2 comments
Closed

Consuming a lot of memory while processing images #2407

Artur-Frank opened this issue Oct 11, 2020 · 2 comments
Labels

Comments

@Artur-Frank
Copy link

Artur-Frank commented Oct 11, 2020

Unfortunately I do not speak English well. therefore I am writing through a translator.
When I use sharp for image processing and turn off the cache, each image takes up memory.
Tracking memory consumption via pm2. And when I load a large image through api, it can increase memory consumption by 15-20mb.

Node: 14.11.0

const sharp = require('sharp');
sharp.cache(false);
///
await sharp(_image[0].data).jpeg({ progressive: true }).toBuffer()
                    .then(async (buffer) => {
                        await fs.writeFile(`${workspaceRoot}/public/publication_${_datetime}_user${_id}_350_350.jpeg`, await sharp(buffer).resize(350, 350).toBuffer());
                        return await fs.writeFile(`${workspaceRoot}/public/publication_${_datetime}_user${_id}_orig.jpeg`, buffer)
                    })
@lovell
Copy link
Owner

lovell commented Oct 11, 2020

Hi, did you see #955, which is the canonical guide to perceived memory issues? If not, please make sure you've read and understood all of it.

@lovell
Copy link
Owner

lovell commented Nov 5, 2020

I hope this information helped. Please feel free to re-open with more details if further assistance is required.

@lovell lovell closed this as completed Nov 5, 2020
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