I'm encountering this problem. I've memory leaks as I start and reboot my app 5 times. It seems that phonegap and the Cordova browser leaves in memory some objects.
07-28 03:48:01.886: E/dalvikvm(10729): Failed adding to JNI local ref table (has 512 entries)
07-28 03:48:01.895: E/dalvikvm(10729): VM aborting
07-28 03:48:01.895: A/libc(10729): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
As soon the app crashesh I can normally restart the app again and it works for other 5 times. So how can I normally kill my app so to remove all javascript in memory ?
// about 116 script elements
que.forEach(function (f, i) {
var s = d.createElement('script');
s.async = false;
s.src = f;
s.onload = function () {
loaded++;
p = loaded / que.length;
//TODO: code for updating progress bar
};
d.body.appendChild(s);
que[i] = s;
});
This didn't solve the problem too:
for (var i = tags.length; i >= 0; i--){ //search backwards within nodelist for matching elements to remove
if (tags[i] && tags[i].getAttribute('src') != null) {
tags[i].parentNode.removeChild(tags[i]); //remove element by calling parentNode.removeChild()
for (var prop in tags[i]) {
delete tags[i][prop];
}
}
}