I have a table of frequently updated information. This is presented using a container div with a div for each row, each row containing 10 divs.
I am using setInterval to call a an asmx webservice that returns some json formatted information.
On the success callback I call $("#myContainer").empty();
on the container div and recreate the rows and 10 nested divs for each row's columns.
This page may be left to run for a whole day, so I am wary of updating the DOM like this as I have noticed that memory does rise for the browser over time (IE8).
The other approach I am considering is to add an id to the row div. When new results process each item of data, look for the corresponding row, if it exists overwrite the data in each div. If it doesn't exist (new data for example), append the row.
What approaches have others used for this sort of long lived pseudo realtime information display.
TIA
Using Memory Profilers Memory profilers are tools that can monitor memory usage and help detect memory leaks in an application. Profilers can also help with analyzing how resources are allocated within an application, for example how much memory and CPU time is being used by each method.
To avoid memory leaks, memory allocated on heap should always be freed when no longer needed.
To find memory leaks and inefficient memory usage, you can use tools such as the debugger-integrated Memory Usage diagnostic tool or tools in the Performance Profiler such as the . NET Object Allocation tool and the post-mortem Memory Usage tool.
DEFINITION A memory leak is the gradual deterioration of system performance that occurs over time as the result of the fragmentation of a computer's RAM due to poorly designed or programmed applications that fail to free up memory segments when they are no longer needed.
In general, a very safe way to prevent memory leaks is to refrain from destroying and re-creating DOM elements. In situations such as yours, I always try to keep the initial DOM structure, and simply update the inner text of the elements when fresh data from AJAX requests is available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With