You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS: mac os 10.12.6 / centos 6.5 / ubuntu 16.04 ( i had tested under 3 OS)
node canvas : 1.6.7 ( now fabric.js only support 1.x.x)
fabric.js: v2.0.0-beta.7 (the latest version)
I found that there is a very bad memory leak issue ( maybe caused by node-canvas ,look at here : Automattic/node-canvas#1003 ) in fabric.js with nodejs.
Here is my test code :
...
{
let canvas = fabric.createCanvasForNode(800, 800);
canvas = null;
}
...
After called this code several times , memory usage grow from 78 MB to 1 GB.
i found a solution here : ( #1997 )
var canvas = fabric.createCanvasForNode();
// blah blah canvas manipulation
canvas.clear();
canvas.dispoose();
// garbage collection should be good now
BUT a new error came out:
TypeError: canvas.dispoose is not a function.
is there any solution in my case?Or fabric.js support node-canvas > 2.0.0.beta5 ?
Thank you very much .
The text was updated successfully, but these errors were encountered:
dispoose is not a function. dispose is.
Can you try that?
You have to dispose a canvas since once you create a canvas other 2 gets created ( a cache one and a top layer one, and without disposing maybe they do not get cleared properly )
@asturur
Thankyou very much for help!
I have tried "canvas.dispose();" It works fine in sync code like this:
var canvas = fabric.createCanvasForNode();
// blah blah canvas manipulation
canvas.clear();
canvas.dispose();
but i found that it does't work by calling in async code like this:
var canvas = fabric.createCanvasForNode();
canvas.loadFromJSON(jsonObj, () => {
canvas.renderAll();
....
canvas.dispose();
})
OS: mac os 10.12.6 / centos 6.5 / ubuntu 16.04 ( i had tested under 3 OS)
node canvas : 1.6.7 ( now fabric.js only support 1.x.x)
fabric.js: v2.0.0-beta.7 (the latest version)
Hi @kangax
I found that there is a very bad memory leak issue ( maybe caused by node-canvas ,look at here : Automattic/node-canvas#1003 ) in fabric.js with nodejs.
Here is my test code :
...
{
let canvas = fabric.createCanvasForNode(800, 800);
canvas = null;
}
...
After called this code several times , memory usage grow from 78 MB to 1 GB.
i found a solution here : ( #1997 )
var canvas = fabric.createCanvasForNode();
// blah blah canvas manipulation
canvas.clear();
canvas.dispoose();
// garbage collection should be good now
BUT a new error came out:
TypeError: canvas.dispoose is not a function.
is there any solution in my case?Or fabric.js support node-canvas > 2.0.0.beta5 ?
Thank you very much .
The text was updated successfully, but these errors were encountered: