datamaps icon indicating copy to clipboard operation
datamaps copied to clipboard

World map bubbles leak memory

Open sumeetkpatel opened this issue 9 years ago • 1 comments

I am using the world map to plot some data in a live fashion where the bubbles update frequently and am noticing awsnap's from that page fairly frequently, upon investigation it seems every time a call is made to map.bubbles() with a new set of 'bubbles' to plot, it works but the old d3 svg nodes still remain and seem to use a fair amount of memory eventually causing the tab to be aborted (chrome).

I was able to limit the issue by removing all d3 circle nodes before adding new bubbles.

ie. d3.selectAll("circle").remove(); before map.bubbles()

You can see a basic example here: Leaking example Not Leaking example

The chrome task manager can be used to observe the leak.

sumeetkpatel avatar May 31 '16 06:05 sumeetkpatel

I encountered a similar memory leak issue. I'm not using the bubbles feature but I'm loading many times a wordmap via ajax (using Turbolinks).

I didn't find any way to free the allocated memory by the worldmap js library and this will cause the browser crash.

dalpo avatar Jul 11 '16 13:07 dalpo