Memory leak when using Select plugin
Memory leak when using Select plugin
I've been trying to track down a nasty memory leak. I'm using the latest version of Datatables in Chrome 54, but I'm using 12,000 rows of data, so any kind of memory leak is bad.
I have narrowed it down to the Select plugin. I've modified an example to create a table with 20,000 rows. I then destroy that table, and take a heap snapshot. My results are:
Before destroy() - 24MB used
After destroy(), select plugin installed - 24MB
After destroy(), no select plugin - 9.5MB
You can profile these two cases yourself:
https://dataheads.ca/tmp/large_js_source.html
https://dataheads.ca/tmp/large_js_source_no_garbage_collected.html
The code is simple, basically:
var data = [];
for ( var i=0 ; i<20000 ; i++ ) {
data.push( [ i, i, i, i, i ] );
}
table = $('#example').DataTable( {
data: data,
deferRender: true,
scrollY: 200,
scrollCollapse: true,
select: true
} );
table.destroy();
table = null;
Any ideas? I must be missing something.