Datatable memory leakage

Datatable memory leakage

bhargavapandeybhargavapandey Posts: 1Questions: 1Answers: 0
edited October 2018 in Free community support

We are using datatabel.net in our asp.net application. during testing we noticed that it consume a lot of memory as described.
on initial load it consume some amount of memory, and as soon as we hit refresh memory consumption increased by X MB (i.e. initial memory + X MB) this keep increase increasing on each refresh. need help to minimize this memory leakage on datatable. Attaching here a piece of code for reference. Column in datatable are dynamically being generated based on configuration that which column need to be displayed/hidden.

$jq.ajax({
        type: "POST",
        url: "Ajax/WorkListAjax.aspx/GetInboxGrid",
        contentType: "application/json; charset=utf-8",
        async: true,
        dataType: "json",
        timeout: 0,
        headers: { Connection: 'keep-alive' },
        data: JSON.stringify({
            "viewId": viewId
        }),        
        success: function (response) {
            var result = response.d;

            if (result.IsError) {
                CustomConfirm("dialog-confirm", result.Message, "Inbox");
                $jq("#inbox_results_loading").fadeOut(1);
            }
            else if (result.Data != null) {
                var tableHeaders = '';
                var columns = [];
                var excludeFilters = [];
                var bulkOperation = result.Data.BulkOperation;
                $jq.each(result.Data.Columns, function (i, val) {
                    
                    if (val.HiddenColumn != "Y") {
                        tableHeaders += "<th>" + val.DisplayName + "</th>";
                        var col = { 'title': val.DisplayName, 'data': val.DataColumnName.toLowerCase() };
                        columns.push(col);
                    }
                    if (val.FilterColumn >= 0) {
                        excludeFilters.push(val.FilterColumn);
                    }
                });
                var data = $jq.parseJSON(result.Data.Results);
                var json = $jq.parseJSON(result.Data.WorkListJQStructure);
                if (result.Data.Xtrattribute) {
                    validationjson = $jq.parseJSON(result.Data.Xtrattribute);
                    validationInboxJson = validationjson;
                }
                else {
                    validationjson = "";
                    validationInboxJson = "";
                }
            

                delete json["bAutoWidth"];

                       
                json.data = data;
                json.columns = columns;
                json.oColumnFilterWidgets.aiExclude = excludeFilters;
                DisplayExportOptions(json.buttons, 'inbox_results', 'ulInboxExportTo');

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @bhargavapandey ,

    The code sample doesn't initialise DataTables, so it looks like you've missed a bit. If you could link to your page, or recreate the issue in a test case, we'd be happy to take a look. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.