Select to view content in your preferred language

legend bug when combined with map.addLayers

580
0
08-06-2013 09:42 AM
JeffPace
MVP Alum
I think i found a bug/memory leak.

I have an app that can load layers based on a config.  The layers can be loaded on the fly

setA (15 layers, some dynamic, some tiled)
setB (3 layers, some dynamic, some tiled)
setC (10 layers, some dynamic, some tiled)

I can start the map with setB, and unload reload (remove all, addLayers[setb]) with no problem
I can do the same with A or B, and switch amongst them, without issue.

ERROR
If i add a legend
I can start the map with setB, and unload reload (remove all, addLayers[setb]) with no problem
I can start the map with setA, and switch to setB, without problem. 
If I start with any set, and switch to A or C, firefox usage goes up over 1 gb, goes not responding, never comes back (and the "onaddlayersresult event never fires")

if i change to code to

if(legend){
legend.destroy();
map.addLayers[setB];
createLegend();}

it works perfectly, in just a few seconds.

bug/memory leak? ir bad workflow.  Right now i have to code in to replace the legend , but it seems "hacky"
0 Kudos
0 Replies