Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tim Sanders on Nov 14, 2008 08:53
open dhtmlx forum
Memory Management

I am developing some pages (with Enterprise License) that will serve as "hubs" for some business processing. A primary page with a layout control provides a navigation control (accordion) on the left and a pane on the right for the contents to display when you click in the navigation accordion. The pages that appears in the right pane are loaded as urls and also use grids and tabs to show different ajax-provided data within a page.

After I have been testing for awhile going between pages I use up all memory. I was using iframes but switched to iframe. That helped some but I'm still eating huge chunks of memory with each new page that loads. Can you tell me what things I need to do to reduce/eliminate the leaking of memory? I'm concerned that I won't be able to utilize this "hub" concept because of memory usage, and this was a major reason we licensed the controls.

Thanks.
Answer posted by Support on Nov 17, 2008 07:14
JavaScript is a language with automatic garbage collection, there is no way to control memory usage from the script itself. 
IE has known issue with AJAX data loading ( the component used for data loading not free memory until page reloaded ) which can't be fixed at all. 

In case of iframe based data loading, the default way can be slightly changed to not-recreate iframes for each new loading, which may decrease memory requirements. 
Answer posted by Tim Sanders on Nov 17, 2008 08:27

You say that "the default way can be slightly changed to not-recreate iframes for each new loading".  Does this involve a change to your standard script or is there a setting I can use to try this?

Thanks.

Answer posted by Support on Nov 18, 2008 05:36
When you first time attach url layout create a link to iframe into which this url is loading
This iframe can be accessed through dhxLayout.cells("a")._frame
Now you can manipulate directly with frame skipping dhxLayout.cells("a").attachURL();
Answer posted by Tim Sanders on Jan 15, 2009 07:11

I am still not sure what you mean by "create a link to iframe" and then "manipulate directly with frame skipping dhxLayout.cells("a").attachURL();"  I'm interested in minimizing memory leaks but don't understand your suggestion.

Thanks.

Answer posted by Support on Jan 21, 2009 04:18
For example:

function attachURL(url) {
    if (!dhxLayout.cells("a")._frame) {
        dhxLayout.cells("a").attachURL(url);
    } else {
        dhxLayout.cells("a")._frame.src = url;
    }
}