it's been some time since the last post but i also have the problem that used memory is growing everytime i create a datatable with tabletools, but only if flash buttons are used. i am far from having the knowledge, but i found out what helps me in my case. i use ajax call to clear a div in my site and then load the table definition in this div, and then create the datatable with tools. i have a menu, and you can show different tables with different structure in the main area. everytime when you want to show a new table, i clean the div (datatable.fnDestroy(), div.empty()) and load the new one. even after recompiling the flash (without event listeners and call backs etc, only to test) the leak was there.
if you look at zeroclipboard, you will see that every client (flash button) is added to .clients, and the nextId is increased. i noticed that after killing a table with tools and creating a new one with ajax, the .clients was still not empty. i checked the nextId, if i load my page the nextId is 1 at the start and 3 after adding 3 flash buttons, and if i destroy the table and empty() the div incl. the tabletools, and reload with ajax, the nextid starts with 4 and also the new client is added to .clients. maybe this prevents ie from collecting garbage ?
my solution (sorry, as i said i'm not an expert but it solves my problem):
add to tabletools the function:
"fnCleanUp": function ()
{
for ( var cli in ZeroClipboard_TableTools.clients )
{
if ( cli )
{
var client = ZeroClipboard_TableTools.clients[cli];
{
client.destroy();
}
}
}
ZeroClipboard_TableTools.clients={};
ZeroClipboard_TableTools.nextId=1;
}
and in the main page call it whenever a table is destroyed:
...
oTableTools.fnCleanUp();
$(table).dataTable().fnDestroy();
$("#dynamic").empty(); (this is the div used to display the table)
if (typeof(CollectGarbage) == "function")
{
CollectGarbage();
}
...
Replies
if you look at zeroclipboard, you will see that every client (flash button) is added to .clients, and the nextId is increased. i noticed that after killing a table with tools and creating a new one with ajax, the .clients was still not empty. i checked the nextId, if i load my page the nextId is 1 at the start and 3 after adding 3 flash buttons, and if i destroy the table and empty() the div incl. the tabletools, and reload with ajax, the nextid starts with 4 and also the new client is added to .clients. maybe this prevents ie from collecting garbage ?
my solution (sorry, as i said i'm not an expert but it solves my problem):
add to tabletools the function:
"fnCleanUp": function ()
{
for ( var cli in ZeroClipboard_TableTools.clients )
{
if ( cli )
{
var client = ZeroClipboard_TableTools.clients[cli];
{
client.destroy();
}
}
}
ZeroClipboard_TableTools.clients={};
ZeroClipboard_TableTools.nextId=1;
}
and in the main page call it whenever a table is destroyed:
...
oTableTools.fnCleanUp();
$(table).dataTable().fnDestroy();
$("#dynamic").empty(); (this is the div used to display the table)
if (typeof(CollectGarbage) == "function")
{
CollectGarbage();
}
...