In JavaScript, if you declare a constructor like this:
var PMFont = function(text, font, size) {
this.text = text;
this.font = font;
this.size = size;
/*
...
ton of code
...
*/
x = 15;
};
var test = new PMFont('dd', 'Arial', 92);
And you create a global variable like the example above: x = 15;
, is there a way to know, once your object has been created, if there are new global variables that have been created?
I've downloaded some code, and I'd like to know if there are some useless variables like in my example that stay in memory. I may run into far worse problems, for example:
imgd = ctx.getImageData(0, 0, this.baseWidth, this.baseHeight)
...gets all the data of an HTML5 canvas 2D context, and if it's not freed it takes a lot of RAM.