No, this is how prototypal inheritance works. Consider an Array method like, say, push. Every array in memory does not have this function. Instead, Array.prototype has this method, and when the JS interpreter sees you reference it, it first looks at the array itself, and, not finding a property called "push" it looks at the array's prototype. If it didn't find it there, it would look at the array prototype's prototype and so on until it hit Object.prototype. This form of inheritance is very memory efficient.
Consequently, your class instances only have memory used to store the things you assign to them. For instance, if your initialize method looks like this:
initialize: function(element) {
this.element = element;
}
now your class has an actual assignment for element, and it cannot inherit this property from its parent. In this case, this is just a pointer to an object already in memory (an element), but if you create an array or something, then that means every instance will have its own in memory:
nitialize: function() {
this.array =[1,2,3];
}
This is not 100% accurate though. Because we don't want to copy references (so that a if one class instance changes a property that all class instances don't change). Because of this, all class properties that are arrays have to be copied, so if you have a class like this:
var X = new Class({
foo: [1,2,3]
});
every time you create a new instance of X that array gets copied into memory.
This is correct. So long as you assign values to elements using only MooTools methods, and so long as you attach events and other such properties using MooTools methods, your code should garbage collect cleanly.
You can test for memory leaks quite easily. Simply create a test (say, it creates an instance of your class), and put it in a loop that executes, say, 1000 times. Open up a memory viewer (for OSX it's just the Activity Monitory) and load your page. Then reload it. You should see the memory footprint reset on reload and return to were it was the first time you loaded the page. If you see it step up and up each time you reload, you have a leak. This is a little old, and I was running windows when I wrote it, but it still mostly holds true: