var ews = {};
(function (ews) {
function testFunction1(a) {
var num = a;
return function(b){
return num = addOne(num);
}
}
function addOne(a){
a++
return a;
}
ews.publicFunction = testFunction1;
})(ews);
function start(){
var number = ews.publicFunction(5);
var result = number(6);
var element = new Element('span', { 'id': 'testSpan', 'class': 'test' }).insert('stop:_' + result);
ews.eventElement = element.on('click', eventFunc.bind(element));
$('container').insert(element);
}
function eventFunc(event,element) {
ews.eventElement.stop();
ews.eventElement = null;
element.purge();
element.remove();
element = null;
delete (element);
}
As you can see I'm creating a simple HTML span, adding an
event to it and inserting the span to my HTML body.
Before clicking IE8 keeps 49.664 Kb
Normally after clicking I'm removing everything, the
element and the event but the memory grows instead of going down!!
After clicking IE8 keeps 49.800 Kb
It's a small difference but I still can't understand why
after destroying everything the memory grows. Also, in my real application I
have thousands of events so I have thousands of Kb growing and growing every
time a user clicks.
Thanks a lot for your time and help.
Kr, Jose