I am using svg to scribble over the image in ipad phonegap application.
The code for initializing the svg is:
function initDrawing(){
var paper;
var masterBackground ;
paper = Raphael(document.getElementById('scroller'),780,1500);
masterBackground = paper.image("data:image/jpg;base64,"+test,0,0,780,1500);
}
I am using raphael.js library to create svg element.
everything works fine. I have next and previous button. If I click next button again function initDrawing() is called. The new image is loaded and now hand scribbling gets slower. Each time I click next button the scribbling gets slower and slower. Why is it happening? Where has a memory leak occurred?
Have you checked what your DOM looks like? Looks like you might just keep adding images, instead of replacing an existing one.
If you really want to keep old images around, you should at least set
display="none"on them.