memory leak drives me crazy

memory leak drives me crazy

OenselOensel Posts: 19Questions: 4Answers: 1
edited August 2015 in Free community support

I'm using datatables 1.10.5 and use many tables, but normally only one is displayed.
In the basic datatable I use auto-refresh every 60 seconds, but you can also refresh by using a button.
Every time a refresh is done, the number of objects in "Chrome Developer Tools" increases.
If you use my application for a longer time it needs up to 1GB of RAM.

I have no idea where this objetcs are from. I deleted every event-listener and dropped every object of the table before refreshing it, but the result was still the same.

Any ideas how to find the leak ?

my refresh-function:

function refreshTable(tableName)
{       
    var tableApi = $('#'+tableName).DataTable();
    tableApi.ajax.reload(function(){fnInitArray[tableName]();}); // fnInitArray only sets an URL
}

Debug-Link: https://debug.datatables.net/ayenul

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,728Questions: 1Answers: 10,506 Site admin

    First thing to do is update to 1.10.8 and the latest versions of any extensions you are using.

    After that, its a case of debugging it if the problem still exists. The Chrome tools are excellent for that, and I could take a quick look if you gave a link.

    Allan

  • OenselOensel Posts: 19Questions: 4Answers: 1
    Answer ✓

    sorry, for answering so late.
    I don't have the possibility to post a jFiddle Link, because my code is too complicated.

    But I found the solution.
    I use a "drawCallback" and in this I added event-handlers to cells, columns etc.
    This was done at every redraw (every minute).

    So I use delegated event-handlers now and call them after initialization.
    The leak ist foud and fixed ;-)

This discussion has been closed.