Automattic / Automattic/node-canvas

Out of memory in Image.set

Open
#2,154 0 comments 0 reactions 0 assignees View on GitHub
Needs more info
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

Hi.

[Nest] 498 - 11/01/2022, 5:55:05 PM ERROR [ExceptionsHandler] out of memory
Error: out of memory
at setSource (/root/tg-export/node_modules/canvas/lib/image.js:94:13)
at Image.set (/root/tg-export/node_modules/canvas/lib/image.js:40:9)

40----------->
setSource(this, Buffer.from(content, isBase64 ? 'base64' : 'utf8'), val)

94---------->
SetSource.call(img, src)

==========

my code:

var img = new Image();

img.onload = function () {

var canvas = createCanvas(width, heightLimit * imageScale);
var ctx = canvas.getContext('2d');
ctx.drawImage(
img,
pad - 3,
0,
srcWidth - pad + 3,
heightLimit,
0,
0,
width2,
heightLimit * imageScale,
);

===============

in my local server on windows it worked OK, node max memory < 500 Mb

but on virtual server on debian was that error "out of memory"

RAM = 32 Gb

width image = 3500
height = 4200

what is it?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.