-
deleting a variable
can we delete a variable?
for example I create a global variable for a class
var _a:Object = null
can I ever delete or remove _a ?
-
_a is a reference. That is to say, a pointer. The variable _a itself only takes up enough memory to store a memory address. This is only a couple of bytes. Those couple of bytes cannot be deleted unless the instance of the class containing them is.
The thing _a points to (the Object) is eligible for garbage collection as soon as no accessible references such as _a point to it anymore. It may not actually be collected for some time after it is eligible. That's up to the virtual machine.
There is a 'delete' operator which applies only to dynamic properties. Those are the undeclared properties which are added to classes which are declared to be dynamic. The two most common dynamic classes are Object and MovieClip, though you can define your own.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|