jQWidgets Forums

jQuery UI Widgets Forums Grid jqxGrid version v6.0.5 (2018-July)

This topic contains 2 replies, has 2 voices, and was last updated by  ApexAnil 6 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • jqxGrid version v6.0.5 (2018-July) #102554

    ApexAnil
    Participant

    In Google chrome after executing ‘destroy’ of jqxGrid element b.jqx.dataview is still showing in Memory which retained size is 5122 in sample code.
    Memory leak image

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Memory Test Page</title>
        <link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />
        <script src="scripts/jquery-2.2.0.min.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdata.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxscrollbar.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxmenu.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.edit.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.sort.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.selection.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.filter.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.grouping.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.columnsresize.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.columnsreorder.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxgrid.aggregates.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxlistbox.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdropdownlist.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxcheckbox.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxcalendar.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxnumberinput.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdatetimeinput.js"></script>
        <script type="text/javascript" src="jqwidgets/globalization/globalize.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdropdownlist.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxcombobox.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdropdownlist.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxdropdownbutton.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxcombobox.js"></script>
        <script type="text/javascript" src="jqwidgets/jqxpanel.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $('#gridDailyTransaction').data("CurrentForm");
                $('#gridDailyTransaction').data("CurrentForm", "FINANCIAL_STATEMENT");
                var data = '[{"dStockDate":"2001-01-01T00:00:00","cScripCode":"ANIL01","cDpid":"01","cDpcode":"01","nStkavailable":1,"nMaxQtyAllowed":0,"nStkpickup":0,"cStatus":"PASS"},{"dStockDate":"2001-01-02T00:00:00","cScripCode":"ANIL02","cDpid":"02","cDpcode":"02","nStkavailable":2,"nMaxQtyAllowed":1,"nStkpickup":1,"cStatus":"PASS"},{"dStockDate":"2001-01-03T00:00:00","cScripCode":"ANIL03","cDpid":"03","cDpcode":"03","nStkavailable":3,"nMaxQtyAllowed":2,"nStkpickup":2,"cStatus":"PASS"},{"dStockDate":"2001-01-04T00:00:00","cScripCode":"ANIL04","cDpid":"04","cDpcode":"04","nStkavailable":4,"nMaxQtyAllowed":3,"nStkpickup":3,"cStatus":"PASS"},{"dStockDate":"2001-01-05T00:00:00","cScripCode":"ANIL05","cDpid":"05","cDpcode":"05","nStkavailable":5,"nMaxQtyAllowed":4,"nStkpickup":4,"cStatus":"FAIL"},{"dStockDate":"2001-01-06T00:00:00","cScripCode":"ANIL06","cDpid":"06","cDpcode":"06","nStkavailable":6,"nMaxQtyAllowed":5,"nStkpickup":5,"cStatus":"PASS"}]';
                var source =
                {
                    datatype: "json",
                    localdata: data,
                    datafields:
                    [
                        { name: 'dStockDate', type: 'date' },
                        { name: 'cScripCode', type: 'string' },
                        { name: 'cDpid', type: 'string' },
                        { name: 'cDpcode', type: 'string' },
                        { name: 'nStkavailable', type: 'number' },
                        { name: 'nMaxQtyAllowed', type: 'number' },
                        { name: 'nStkpickup', type: 'number' },
                        { name: 'cStatus', type: 'string' }
                    ]
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
                $("#gridDailyTransaction").jqxGrid({
                    width: '99%',
                    height: '100%',
                    columnsheight: '40px',
                    columnsresize: true,
                    pageable: false,
                    sortable: true,
                    filterable: true,
                    altrows: true,
                    groupable: true,
                    showgroupsheader: false,
                    enablehover: false,
                    enabletooltips: true,
                    showfilterrow: true,
                    showstatusbar: true,
                    showtoolbar: false,
                    showaggregates: true,
                    statusbarheight: 30,
                    autoshowfiltericon: true,
                    source: dataAdapter,
                    editable: false,
                    selectionmode: "singlerow",
                    keyboardnavigation: true,
                    columnsreorder: true,
                    columns: [
                                    { text: 'Stock Date', columntype: 'textbox', datafield: 'dStockDate', width: 100 },
                                    { text: 'Scrip Code', datafield: 'cScripCode', columntype: 'textbox', width: 100 },
                                    { text: 'Dp ID', columntype: 'dropdownlist', datafield: 'cDpid', width: 100 },
                                    { text: 'Dp Code', datafield: 'cDpcode', width: 70, cellsalign: 'left', width: 100 },
                                    { text: 'Stock Available', datafield: 'nStkavailable', cellsalign: 'right', cellsformat: 'c2', width: 100 },
                                    { text: 'Max Quantity', datafield: 'nMaxQtyAllowed', cellsalign: 'right', cellsformat: 'c2', width: 100 },
                                    { text: 'Stock Pickup', datafield: 'nStkpickup', cellsalign: 'right', cellsformat: 'c2', width: 100 },
                                    { text: 'Status', datafield: 'cStatus', cellsalign: 'left', width: 100 }
                    ],
                    autoloadstate: false,
                    autosavestate: false,
                    autoshowfiltericon: true,
                });
                $('#btnInsertData').click(function () {
                    $("#gridDailyTransaction").jqxGrid('addrow', null, {})
                });
    
                $('#btnDestroy').click(function () {
                    $('#gridDailyTransaction').unbind();
                    $('#gridDailyTransaction').jqxGrid('destroy');
                    source.localdata = null;
                    source = null;
                    dataAdapter = null;
                });
            });
        </script>
    </head>
    <body>
        <div id="divGridContainer">
            <div id="gridDailyTransaction">
            </div>
        </div>
        <input id="btnInsertData" type="button" value="Insert Data" />
        <input id="btnDestroy" type="button" value="Destory Grid" />
    </body>
    </html>
    jqxGrid version v6.0.5 (2018-July) #102558

    Peter Stoev
    Keymaster

    The garbage collection is handled automatically by the web browser. Calling destroy of the Grid removes its resources, but it is not guaranteed that right after calling destroy, the Chrome’s garbage collector will be called as it is based on its own logic and algorithm.

    Regards,
    Peter

    jqxGrid version v6.0.5 (2018-July) #102559

    ApexAnil
    Participant

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.