Clear datatables and browser memory

Clear datatables and browser memory

delphi10delphi10 Posts: 17Questions: 8Answers: 0

Use $('#example').DataTable().clear().draw(); to free memory in browser,
Task manager in browser not show change to memory.

What else can i do?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 14,465Questions: 1Answers: 2,465

    How big is your table when you clear it? There could be any number of memory cache involved here, so the clear() may have no immediate effect.

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. 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

  • delphi10delphi10 Posts: 17Questions: 8Answers: 0
    edited August 19

    My (big) data is text file.

    Read my data:
    "ajax": {
    "url": file,
    "type": "POST",
    "dataType": "json"
    }

    How can upload in live.datatables my test file?

  • allanallan Posts: 56,888Questions: 1Answers: 9,042 Site admin
    Answer ✓

    There isn't a way to upload a custom JSON file to the live site I'm afraid.

    Have you used the memory profiler in the browser? That is probably more reliable than the task manager for this sort of thing (Chrome, or whatever you are using) might keep the RAM wired in for a bit for example. Also keep in mind that it is up to the JS engine when it performs garbage collection - we can't force it. But the memory profiler in the browser will give you a better idea of what is happening.

    Allan

  • delphi10delphi10 Posts: 17Questions: 8Answers: 0

    Example 1 loading data HTML (DOM). Here is sample http://live.datatables.net/naliperu/2/edit Insert styling table.
    Bad: Unfortunately, such a solution does not allow many rows. I get in browser Out of memory.

    Example 2 insert data in JSON file with read parameters "ajax": { "url": file,"type": "POST","dataType": "json"}
    Bad: Sorry I can't keep the table styling from Example 1.

    How load 10k+ rows and preserve styling of table?

  • allanallan Posts: 56,888Questions: 1Answers: 9,042 Site admin

    Probably just a limitation of the live site. Maybe using https://stackblitz.com/ might be a better idea. You can Ajax load a file there.

    Allan

Sign In or Register to comment.