Memory leak in grid?

I have set up a file with a refresh interval of every second as below:

I am not sure if the code is correct but this appears to leak memory in Internet Explorer (I am using version 9), not sure about other browsers. I am doing it this way as I hoped that the destructor would release the memory because the leak also appears when using updateFromXml.

I can post the url if you want to see it and I can also decrease the interval to a tenth of a second as this shows up a bit quicker.

In case of IE - there is a problem with xml loading - IE uses active-x element for such task, and it is not affected by garbage collector ( at least not until page reloading )

Also, in common case, if you need just refresh grid you can use more simple approach

deviceRefreshInterval = setInterval( function() { deviceList.clearAll(); deviceList.loadXML("testGridxml.txt"); }, 1000 );

it will just reload data instead of full grid reconstruction

Thanks. I will try this approach to refresh and let you know.

Yes, the appears to be stable, I will run this for several hours to check. Is there any way of the grid refresh just to change data values rather than ‘blink’ each time? Or is this just browser dependent?

If you need only update data for already existing rows, you can use

deviceRefreshInterval = setInterval( function() {
deviceList.updateFromXML(“testGridxml.txt”);
}, 1000 );

Also, it possible to use previous approach but move clearAll command in xml itself, so clearing and new data rendering will be executed in single js cycle

You may use clearAndLoad() method to reload data of your grid.

deviceRefreshInterval = setInterval( function() { deviceList.clearAndLoad("testGridxml.txt") }, 1000 ); }

Also you even may use updateFromXML(). It allows you to load only the changed data, but not the full data.

deviceRefreshInterval = setInterval( function() { deviceList.updateFromXML("testGridxml.txt") }, 1000 ); }

This one at www.shodokan.net/griddhtmlx2.php

deviceRefreshInterval = setInterval( function() {
deviceList.clearAndLoadXML(“testGridxml.txt”); }, 1000 );
}

and this one at www.shodokan.net/griddhtml3.php:

deviceRefreshInterval = setInterval( function() {
deviceList.updateFromXML(“testGridxml.txt”); }, 1000 );
}

both appear to leak memory having run them for a while.

This one at www.shodokan.net/griddhtmlx2.php
deviceRefreshInterval = setInterval( function() {
deviceList.clearAndLoadXML(“testGridxml.txt”); }, 1000 );
}

Please, try to replace

 deviceList.clearAndLoadXML("testGridxml.txt"); }, 1000 );

with

 deviceList.clearAndLoad("testGridxml.txt"); }, 1000 );

and this one at www.shodokan.net/griddhtml3.php:

deviceRefreshInterval = setInterval( function() {
deviceList.updateFromXML(“testGridxml.txt”); }, 1000 );
}

Unfortunately the link cannot be opened. PLease, check if it is correct

Sorry, that should have been: www.shodokan.net/griddhtmlx3.php

Unfortunately your link works well in IE.
Data refreshes correctly.

Yes, the data refreshes correctly, but let is run for some time refreshing every second and I think you will see that the memory usage creeps up. I am running shodokan.net/griddhtmlx.php, which contains:

deviceRefreshInterval = setInterval( function() {
deviceList.clearAll();
deviceList.loadXML(“testGridxml.txt”); }, 1000 );
}

and that looks stable. I will try some further tests though.

I am setting up all three to run overnight to see what state the memory usage is in by tomorrow morning.

First:
deviceList.clearAll();
deviceList.loadXML(“testGridxml.txt”);

Second:
deviceList.clearAndLoad(“testGridxml.txt”);

Third:
deviceList.updateFromXML(“testGridxml.txt”);

I will let you know the results tomorrow.
Thanks.

I ran my tests overnight and all three appear to be stable in their memory usage. I will keep the tests running for the time being. Many thanks for your time.

I have started the evaluation by moving the prototype I have into using DHTMLX. I had to backtrack and set up a demo again as I think that there is still problem with memory usage.
The demo I have is at www.shodokan.net/nvr (with a lot of code removed or commented out), ignore the request for login details just click the login button to reach the main demo page. The grid refreshes every second and memory usage appears to be creeping up. Can you see the same?

…I am referring to viewing this demo in Internet Explorer (version 9 I am using) only.

It works not so bad on IE9 locally and seems has a zero memory consumption in IE10
Anyway, you can try to add one more interval and each few minutes call

CollectGarbage();

This is IE-specific method ( not related to dhtmlx ) which will force garbage collector run.

The documentation states that it ‘is not intended to be used directly from your code’ so I do not think this is a good solution.

Refreshing on interval is bad practice, especially every second. You basically have javascript running constantly. Instead, you should just update grid data when necessary. Only update rows that change, when they change.