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
Apologies in advance if work towards addressing this is already in progress, and also thank you for the effort you've poured into this library.
I had originally submited a PR for this (#495) but it seems to have been closed due to inactivity.
The recently released v3.12.0 seems to not include this fix yet, so I'm opening this issue in the hopes this helps it to be resolved quickly.
The issue:
When calling imageEditor.destroy() (which also calls graphics.destroy() under the hood), memory resources are not entirely freed up, causing eventual out of memory errors if multiple image editor instances are created, and subsequently destroyed (like when opening/closing a popup window that contains an image editor instance).
The out of memory errors are more easily reproducible on mobile devices.
The (potential) fix:
I traced the error to graphics.js' destroy method which seems to be calling Fabric.js' canvas.clear() method (which clears canvas properties and objects in it) instead of canvas.dispose().
Although I haven't examined them in deep, I believe this may be related to issues #208, #213, #375, #395, #488 and similar out of memory issues that have been reported in the past.
A workaround:
People experiencing this can potentially address this by explicitly calling canvas.dispose() when destroying an image editor instance:
// When destroying the image editor instance...constimageEditor= ... // Image editor instanceconstcanvas=imageEditor._graphics._canvas;// Get reference to fabric.Canvas objectimageEditor.destroy();// Destroy the image editor instancecanvas.dispose();// Finish disposing canvas resources
The text was updated successfully, but these errors were encountered:
Apologies in advance if work towards addressing this is already in progress, and also thank you for the effort you've poured into this library.
I had originally submited a PR for this (#495) but it seems to have been closed due to inactivity.
The recently released v3.12.0 seems to not include this fix yet, so I'm opening this issue in the hopes this helps it to be resolved quickly.
The issue:
When calling
imageEditor.destroy()
(which also callsgraphics.destroy()
under the hood), memory resources are not entirely freed up, causing eventual out of memory errors if multiple image editor instances are created, and subsequently destroyed (like when opening/closing a popup window that contains an image editor instance).The out of memory errors are more easily reproducible on mobile devices.
The (potential) fix:
I traced the error to
graphics.js
' destroy method which seems to be calling Fabric.js' canvas.clear() method (which clears canvas properties and objects in it) instead of canvas.dispose().Although I haven't examined them in deep, I believe this may be related to issues #208, #213, #375, #395, #488 and similar out of memory issues that have been reported in the past.
A workaround:
People experiencing this can potentially address this by explicitly calling
canvas.dispose()
when destroying an image editor instance:The text was updated successfully, but these errors were encountered: