Hi guys,
I have a big problem in my application, when I create a global class
object is impossible for me to release the memory and I'm having
memory leaks.

I've made a small class as example.

var TestClass = Class.create({


    initialize: function() {
        this.options = {
            vari: '',
            array: '',
            testDiv: ''
        };
        this.addElement();
    },
    addElement: function(element) {
        var a = 0;
        var arrayDivs = [];
        alert('before create element');
        for (var i = 0; i < 2000; i++) {
            var div = new Element('div');
            div.innerHTML = 'test' + i;
            arrayDivs.push(div);
        }
        alert('after create element');
        this.options.vari = 'pepe';
        this.options.array = arrayDivs;
        this.options.testDiv = new Element('div', { 'id':
'testdivPepe' });
        this.destroy();
    },
    destroy: function() {
        alert('before destroy');
        for (var i = 0; i < this.options.array.length; i++) {
            this.options.array[i] = null;
            //this.options.array.pop();
        }
        //this.options.array.splice(0, this.options.array.length);
        this.options.testDiv = null;
        this.options.vari = null;
        this.options.array = null;
        this.options = null;
        //delete this.options.array;
        //delete this.options.testDiv;
        //delete this.options.vari;
        //delete this.options;
        alert('after destroy');
    }
});

I've tryed the delete, put the variable to null, to undefined, also
remove() for the html and no way to release the memory.

I really need some help here. can you give a hand here?

Kr, Jose

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to