dataTables crashing iPad

dataTables crashing iPad

fogcityfogcity Posts: 7Questions: 0Answers: 0
edited September 2010 in Bug reports
dataTables appears to be crashing Mobile Safari on the iPad.

i've got a web app with a dataTable with about 6000 cells. although the sorting and pagination features are pretty responsive, it seems to be overloading the device.

after reloading the page a few times, it eventually crashes Safari. same thing happens when i replace the table contents and redraw the dataTable. or occasionally, when i change the orientation and simply redraw the table with a different height. also, when leaving the page and loading a new page that doesn't contain a dataTable.

without the dataTable code, i can't make the same thing happen under any circumstance.

any chance there's a memory leak here? do i need to clean up allocated memory when the page unloads?

again, each of these things cause crashes:

1. changing the table height:
[code]$('#datatable').fnLengthChange();[/code]

2. re-initializing after replacing all table content:
[code]$('#datatable').dataTable().fnDestroy();
$('#datatable').dataTable();[/code]

3. reloading the page currently loaded:
[code]$(document).ready(function()
{
$('#datatable').dataTable();
});[/code]

4. leaving the page via a link to a page with no dataTable

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    I'm not aware of any memory leak in DataTables, but it's always possible. Most certainly the fnLengthChange function shouldn't cause any kind of memory leak - so my guess is that you are just approaching the limit of what the iPad allows for a web-page's memory, and the odd action is pushing it over the edge. 6000 is quite a lot of rows to ask the device to deal with (there are a lot of calculations to deal with), sorting, filtering etc. If you use only 4000 rows, does that help? It might be worth considering server-side processing for this. Also IE is going to struggle with that many rows.

    Allan
  • fogcityfogcity Posts: 7Questions: 0Answers: 0
    edited September 2010
    hi allan, thanks for the quick reply.

    actually my table only has 450 rows. each row has 11 columns, so the table has < 5000 cells (not 5000 rows as you seem to be thinking).

    i have heard rumors that there is 5 MB memory available to web applications on the iPad. then again, supposedly it's 128 MB. either way, there are zero images involved and my total scripts and other files (not including DataTable) take up less than 100k.

    anyway, i have used this exact same setup with the Tablesorter 2.0 plugin for jquery and it works on the same 5000 cells without crashing. so i don't think there is an inherent device limit being hit with my 5000 cells.

    i've attached fnDestroy() to $(window).unload() to attempt to unload memory when leaving the DataTables page, but this doesn't seem to help. is there another way i can explicitly free up the Datatables cache and otherwise purge the memory it was using? any other suggestions? i'd really like to use DataTables rather than Tablesorter but first order of business is no crashing the browser...
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Ah sorry, I misread the 5000. 450 rows and it's crashing the iPad - ouch... Does the browser just quit when it happens? Do you have a link - I can try it on an iPhone to see if it's doing it there.

    fnDestory will completely take out anything that DataTables has added, deleting the instance and all it's information with it.

    Perhaps try disabling a few features to see if that helps at all, particularly filtering and sorting? See if that makes any difference - but I'm a bit surprised that it crashed at only 450 rows. Bit rubbish that...

    Allan
  • fogcityfogcity Posts: 7Questions: 0Answers: 0
    Yes, the browser simply quits when it happens. Pretty difficult to make it not happen. the problems do seem to center on transitioning to another page. I am calling fnDestroy when the window unloads, but that doesn't help.

    I can send you a URL for testing if you send me your email address. Mine is hookandsling at gmail dot com
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    You can ping me using http://datatables.net/contact . So clicking to change the page causes it to crash! The should be one of the simplest operations that DataTables does... If you only have 300 rows, does it do it there as well?

    Allan
  • CarmichealCarmicheal Posts: 1Questions: 0Answers: 0
    edited April 2011
    fnDestory will completely take out anything that DataTables has added, deleting the instance and all it's information with it.


    ---------------------------------
    [url=http://www.ebelow.com/ipad-2-case-iPad2case-iPad-2-cases.html]ipad 2 case[/url]
    [url=http://www.ebelow.com/]Apple Accessories[/url]
    [url=http://www.ebelow.com/iPad2-cases-cheap-iPad2-cases-iPad2-case.html]iPad2 cases[/url]
  • AlawrenceAlawrence Posts: 18Questions: 0Answers: 0
    This does sound odd and I think there may be a different issue occurring as we have a dataset with around 10,000 rows and 11 columns and have heavily tested it with both the IPad and the IPad2. Both device seem to perform without issue.
  • bgordonbgordon Posts: 2Questions: 0Answers: 0
    I have the same issue. I am using server side processing and even showing 10 rows will freeze up safari or chrome on the iPad. Browser freezes completely. Redraws trigger it to on orientation change. Any ideas? Works fine in ff and safari for Mac.
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    I'm not seeing any problem on my server-side processing examples with my iOS device. Can you give us a link please?

    Allan
  • KirthiRamanKirthiRaman Posts: 1Questions: 0Answers: 0
    The row selection (click event) does not work on IPad. It works on other OS, but not IPad.
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    This example seems to work just fine for me in iOS: http://datatables.net/release-datatables/examples/api/select_row.html

    Allan
This discussion has been closed.