Memory Leak

100 views
Skip to first unread message

Donna Peplinskie

unread,
May 8, 2013, 2:13:48 PM5/8/13
to envis...@googlegroups.com
Hi,

I'm hoping I can get some guidance on plugging a memory leak that I'm seeing with Envision.js.

I'm using Envision to show financial charts. Each chart has 7 different durations that are iterated over every 10 seconds. Here's the code I'm using that destroys and then redraws the chart to plot the new data:

this.finance.vis.destroy();
this.finance = null;
this.finance = new envision.templates.PriceChart(options);

I'm confident that this is the code that is leaking. When I leave those lines in, Chrome memory increases steadily. When I comment those lines out, Chrome memory varies within a much more acceptable range. Below is a link to the page I'm testing against. You'll notice that the charts stay the same as the selected buttons change, but that's because I've removed the above lines to confirm that redrawing the chart is what's causing the leak. This is best viewed in Chrome - http://rvaviewer-test.appspot.com/Viewer.html?type=presentation&id=1f911623-b837-49c0-b0b2-0f9d9b24d178&showui=false

We currently have some digital signage screens showing financial charts out in the field that are crashing after about 10 hours. Of course, the more charts, the less time it takes for them to crash.

Do you have any thoughts on what could be hanging around and not being garbage collected? I've tried analyzing the results using Chrome's Profiler Dev Tools, but the results are pretty useless.

Thx!


Donna Peplinskie

unread,
May 8, 2013, 3:05:40 PM5/8/13
to envis...@googlegroups.com
Actually, I changed the page so that it does update the charts in order to see the leak happening.

Donna Peplinskie

unread,
May 24, 2013, 4:56:12 PM5/24/13
to envis...@googlegroups.com
My understanding after doing a significant amount of research is that this is a problem not only in the Flotr library but in other Javascript charting libraries that don't use Flotr. I found that by adding the following one-liner before the call to destroy(), that memory is much improved:

$(".envision-finance-price").empty();

Simon Platten

unread,
May 25, 2013, 1:50:00 AM5/25/13
to envis...@googlegroups.com
Hi Donna, have you tried calling the Garbage collection, you can request that Javascript perform its clean up...but if it doesn't release resources then it would suggest that something is still referencing them.

Hope this helps.

Sy

Simon Platten

unread,
May 25, 2013, 10:08:07 AM5/25/13
to envis...@googlegroups.com
Try:

window.CollectGarbage();




On Wednesday, 8 May 2013 19:13:48 UTC+1, Donna Peplinskie wrote:

Anup Chaudhari

unread,
May 26, 2013, 4:15:58 PM5/26/13
to envis...@googlegroups.com
Hello Donna,
I think you have the same issue as stated here https://github.com/HumbleSoftware/envisionjs/issues/18
Check my reply there and let me know if it help. :)
Reply all
Reply to author
Forward
0 new messages