Doubt on creating new instance of a class
Hi,
I have a situation wherein I would like to know if there is any impact on performance.
I have two custom classes customClass1.as & customClass2.as written below:
class customClass1 {
/* Variables are declared here*/
public function customClass1() {
/* Does some initialisation */
}
/* Contains number of methods to perform various activities */
private function activity1():void {
}
...
...
private function activityN():void {
}
}
class customClass2 {
private var class1Instance:customClass1;
/* Variables are declared here*/
public function customClass2() {
/* Does some initialisation */
}
/* Contains number of methods to perform various activities */
private function activity1():void {
}
...
...
/* This function is an event handler */
private function activityK():void {
/* Here new instance of class 1 is created without making the previously created instance to NULL and this is done many times over the * period of time while application's running
*
* Does this has any impact on performance?
* What happens to the earlier instance when new one is created and assigned to same variable?
*/
class1Instance = new customClass1();
/* Does something */
}
...
...
private function activityN():void {
}
}
Thanks for your time and suggestions.
Regards,
MSH
