You must be logged in to post your query.
Home › Forums › Chart Support › Memory leak?
Tagged: "memory leak" destroy()
Hi, Yesterday I’ve udated Google Chrome. Since then Chrome crashes due to an ‘out of memory’ error after some time. Immediately I suspected Chrome since I recently didn’t change anything in the part of my JavaScript handling my charts. I’ve never used Edge before to handle my chart pages, but this seemed a good reason to give it a try: no success; the same out of memory error occured. Now… why not suspect CanvasJS? I run three different pages with several charts, being updated every ten seconds, executing destroy() prior to rendering. What happens since yesterday is like destroy() is not being executed anymore: the RAM in use by Chrome grows with every chart update, till after a few hours the browser freezes into an out of memory error.
@jse,
We have tested the destroy() and it seems to be working fine.
Can you kindly create a JSFiddle reproducing the issue you are facing and share it with us so that we can look into the code, understand the scenario better and help you out?
___________ Indranil Deo Team CanvasJS
Sorry for my late response.
After going through my code and comparing it with an example for handling dynamic data on this website, I realized that I had made an insane mistake by destroying and declaring a chart for every data update. I got to this by modifying some examples while getting familiar with CanvasJS.
After rearranging my code I don’t even need destroy() anymore and the RAM used by the browser is very modest.
Glad that you were able to figure it out. You can just update the chart options/data and call chart.render for creating a dynamic chart instead of destroying and re-instantiating it.
You must be logged in to reply to this topic. Login/Register