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

Memory leak due to non-existing image rendering #339

Closed
kelvinau opened this issue Apr 27, 2018 · 0 comments
Closed

Memory leak due to non-existing image rendering #339

kelvinau opened this issue Apr 27, 2018 · 0 comments
Labels

Comments

@kelvinau
Copy link
Contributor

kelvinau commented Apr 27, 2018

I actually found this issue when I was using EChart. The issue becomes very serious when I have a logic that tries to get image based on a variable. Size of globalImageCache keeps increasing after EChart's setOption.

When image is being loaded, pendingWrap from createOrUpdateImage is pushed to pending in globalImageCache.

!isImageReady(image) && cachedImgObj.pending.push(pendingWrap);

The pending array is only cleared when the image is loaded successfully. For non-existing image, i.e. onerror, the array will not be cleared.

Memory Increase:
2018-04-27 00_26_47-image

After I added a non-existing image 10 times
2018-04-27 00_30_53-image

After fix:
2018-04-27 00_32_58-image

JSFiddle Demo:
https://jsfiddle.net/kelvinau/y3axsx0w/

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