Menu

SmartGwt destroy chart on canvas removal or tab close

Aleksandar
2013-03-26
2013-03-26
  • Aleksandar

    Aleksandar - 2013-03-26

    I looked into BaseChart source, and found that nativeDestroy is called in overiden onUnload , which is called in Widget's onDeatach. I didn't test this in core gwt widgets, but I have debugged it with smart gwt and nativeDestroy is never called when I try to remove member from parent canvas container , or when i close smart gwt tab.
    This causes memory to grow in apps that needs to create and destroy a lot of charts , or apps like showcase .
    Any idea of how to solve this issue ?

     
  • Anthony McCulley

    How are you trying to destroy the SmartGwt widgets? Removing them from a parent and/or closing a tab won't do it if I remember correctly unless you have some option set in the widget to do so.

     
  • Aleksandar

    Aleksandar - 2013-03-26

    Well, I didn't test smart gwt widgets/canvases, but i dont beleive there would be memory leak if you open 100 tabs and close them. Their showcase is working well . But if you have charts in that tabs, and close them, memory will remain the same (or if you remove charts programatically).
    I made some workaround to manually call chart native destroy when removing chart's wrapper canvas or closing tab , and that slowed down memory build up.

    public static native void nativeDestroy(JavaScriptObject chart) /*-{
        chart.destroy();
    }-*/;
    
    nativeDestroy(gwtChart.getNativeChart());
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.