memory management - How can I unset an (unsigned) integer in ActionScript/Flex 3? -


I have a class that is called multiple times when the application goes to the next step, all of them have to be unloaded . Because of this, I made an unload () method in class.

The problem is that I can not put it to empty my UIT variable "FourID" to "unset" it. The "delete" command is not possible, because it is only applicable for some of the dynamic variables or in that manner.

Now I wonder, how should I unset this variable, so this storage will be allocated again?

Unload method of the class:

  public function unload (): zero {trace ("unload character with a description" "+ + name +" ''. ); EnterButton.removeEventListener (Enter MouseEvent.CLICK, Enter Clutter); removeChild (enterButton); EnterButton = null; CharName = Null; CharId = null; // This is possible but not recommended - Is there a better way? Lobby interface = null ;}  

So yes, this is practically possible because this variable type changes - although it is not recommended and What is a better way to do this?

Keep in mind that this object is also being loaded in its parents, it also frees all these variables from memory. ?

UIT , int , Number and Boolean can not be null qualified in the AS3 number, but this is really the best you can get to Int and uint always cave L 32 bits are there, so you can not bring an empty reference there.

The cleaning you are trying to complete can not be completed after the concept of sealed classes in AS3. In a sealed class there is a fixed size in memory when it comes to frequency variables, then think of it as a C struct , you can only dump it everything, or nothing you can Anything can be done in C, this is a fixed block in memory, one unit of reference per variable.

What do you want to do only work with dynamic variables, which are created separately.

Trash Collection in Flash Most Runtime Nowadays, you do not need to do this type of cleaning, it also works with nested and circular references, the only thing you need to ensure is that You remove any "external" reference to that class. Generally things which are not collected are objects on display list, running timers and intervals, and I / O related stuff. As soon as you have a reference series from your object, it will not be collected.

We say that you have object A with an event handler for a mouse code movement on some list on an object, a object b Refers to. B will not be collected, but as soon as there is no chain for any commodity, it will be collected (now or later, GC is quite lazy.) But the more storage you use, the more work is done. ). / P>


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -