DataTables crashes in Chrome but not in Firefox
DataTables crashes in Chrome but not in Firefox
Fetching data with
$("#id").load("resource", function () {
$("#child_id_of_table_element").DataTable(options))
});
The resource returns html with table element with correct id.
Table that is returned from resource is over 10.000 lines, I know not good but too much work right now to change it.
In firefox it works and displays everything correctly.
In chrome it gives "Aw snap" error SIGILL. No errors in console.
I know it is DataTables because if I don't use it the site doesn't crash and displays the pure html table.
Replies
According to Google SIGILL is a browser problem, not DataTables.
With that number of rows I would look at using
ajax
to load the data. This will be more efficient as Datatables won't need to read all the 10,000 rows from the DOM to build its data cache to display the table. Also see this FAQ about Datatables performance optimizations.Kevin
@tangerine yes It is a browser problem but it only happens when I am using DataTables so I think it has something to do with DataTables.
Edit: Tried on another computer in Chrome and Safari and same thing happens. Crashes in Chrome but okay in Safari.
Did you do as Kevin suggested? No question in my mind - with that many rows, Ajax load them and use
deferRender
. It will save a ton of memory (which is probably what Chrome is running out of).Allan
This is not a feasible solution for me at this time.
Might look at it later. But thanks anyways.
But it might be good if devs look into this.
Only happens on Chrome or Chrome based browsers and either gives Error: SIGILL or Error: Out of memory.
I'm not entirely sure what you want me to do to be honest (I am the DataTables developer). Reading that many rows of data is using up all the memory available on the computer you have. I've given you a solution to that - use Ajax loaded data and defer creation of the DOM nodes until they are needed.
I'm afraid I can't just wave a wand a solve an out of memory issue when using large tables. I've made this little example with 10000 DOM read rows and it works just fine on Chrome for me: http://live.datatables.net/tiseguvi/1/edit . I tried 20k and that worked too.
Firefox will be handling the memory allocation differently from Chrome. The crash is one for the Chrome team.
As I say, use Ajax loading to resolve the issue.
Allan
@FlowFlex I have encountered this too, but I agree with the other comments here that it’s clearly on the Chrome browser end, and not something the Datatables developers can fix. (Chrome gives an “out of memory” error for a 15 MB table on a machine with 64 GB of RAM.)
Do you have pagination enabled for your table? (Set
paging: true
in table options, or just don’t set it tofalse
sincetrue
is the default.) I have found that that avoids the problem in Chrome. Even if the table is big, a smaller page size avoids the crash.