The “Dynamically updated data” demo on the HighStock website seems to leak memory in the current version of Google Chrome (24.0). I’ve tried it on Mac OS X 10.8.2 and Windows 7 (64-bit). I also tried Safari 6.0.2 on OS X, and both IE9 and Firefox 18 on Windows 7. The leaking only seems to happen in Chrome, and it always happens.
Given that this is a fairly prominent demo, I would have expected it to work well. But given enough time, it crashes in Chrome, giving the “Aw, Snap” error page. It can take a long time in the demo as written, but if you click the jsFiddle link and change the setInterval() call to 100 ms instead of 1000 ms, the leak is fairly obvious. A real application with multiple series and a decent amount of data can crash Chrome in just a few minutes.
Note that while data is being added continuously, the “shift” parameter in addPoints() is always true, meaning that old data is being discarded just as quickly. So the memory usage should be fairly constant–and on browsers other than Chrome, it is.
I’m not sure how to tell if this is a Chrome bug or a HighCharts one. And I haven’t found a useful workaround. A conclusive answer to either aspect would be much appreciated.
Inspired by Mark’s comment, I decided to try different versions of various things. First I tried the bleeding-edge versions of jQuery and HighStock. Chrome 24 (stable) still leaked. Then I tried Chrome 23 since it worked for Mark on Fedora, but it still leaked on Mac OS.
Then I tried the Chrome Canary build, 26.0. It worked, with no leaks! It exhibited the classic garbage collection pattern of building up a few dozen megabytes excess memory usage, then falling back down to “normal”, every few seconds. So that’s good news. The bad news is that Chrome Beta, 25.0, still leaks. So if other users of HighCharts experience this issue in the next couple months, they’ll need to either use an “unstable” version of Chrome, or just a different brand of browser.