I have an image rotator that creates a div for a new slide, hides the current slide, shows the new div, and removes the hidden div.
All this is done with jquery and I’m using this code to remove the slides I don’t need anymore:
var last = $("#item_" + lastSlide + "_" + idSuffix);
last.empty();
last.remove();
last = null;
The memory is still increasing after each slide.
Any ideeas about how can I efficiently clear the memory?
The best solution I’ve came up with was to clear the html content before I remove the element.
For example: