:: Forum >>

reuse of variables and destructors ...

can I reuse a AW variable without creating memory leak or worse ?
var a= new AW.UI.Checkbox; .....; a= new AW.UI.Input; ....

In other words, is there any destructor that I should call before reusing variable "a" ?
Philippe Marzin
Tuesday, March 11, 2008
If you just reuse the variable - the object will not be released from memory. This is because each AW object registers itself in the global array - AW.all. I don't think there is much problem with that unless you create thousands of AW objects. If you really want to remove the AW object from memory you should also clear the reference from AW.all array -

AW.all[obj.getId()] = null;
Alex (ActiveWidgets)
Tuesday, March 11, 2008

This topic is archived.

Back to support forum

Forum search