Christian Adler

Memory Leak On Redrawing Gauge

Recommended Posts

Hello,

 

our web apps stay open for long times (days to month). This is why memory leaks are allways critical.

 

I'm testing the angular gauge with annotations. Not only the value of the gauge changes, also the annotations may change on every update. Therefor the setData method is not enough - i have to redraw the full gauge (on new data).

The data is requested periodically per ajax. So what's the correct way to redraw the gauge without memory leaks?

 

After every request this code will be executed: (create gauge only once and setJSONData if available | App is my global application object)

var instrument = App.instrument;
                        
if(instrument === null)
{
    instrument = new FusionCharts("AngularGauge", "instrumentId", "100%", "100%", "0");
    instrument.setTransparent(true);
    App.instrument = instrument;

    instrument.render("div_instrument"); //id of rendering div
}

//JSON data from ajax request
var gaugeData = jsonData.result.gaugeData

// redraw?
if(gaugeData) {            	
    instrument.setJSONData(gaugeData);
}

 

The used memory raises on every setJSONData. Taking Heap Snapshots (Google Chrome -> [F12] -> Profiles -> Take Heap Snapshot -> Dominators) there is one object that grows rapidly (see attached png post-46061-0-81253000-1370253075_thumb.png).

Is there a way to reset / clear the gauge? I'm using the latest version of the widgets (@version fusioncharts/3.3.1-sr2.19840)

 

Regards,

Christian Adler

Share this post


Link to post
Share on other sites

Until now unfortunately i got no solution :(

I also asked the support team too - but no solution yet.

 

My first attempt was the dispose() method and creating a new gauge every time. 'dispose' was suggested by the support team too. But there is no change in the memory using behaviour.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now