I'm writing dispose methods for all my classes so I can make their objects eligible for Garbage Collection by reference counting when I'm done with them. If a class variable is for an
Number, I don't have to null it out in my dispose method, correct? What about arrays/vectors that contain those data types? I don't have to do
array.length = 0 either, right? But I have to do
array = null. What about strings? Are there any other data types that I don't have to null references for?
Best How To :
first of all why you do such thing and when you will call those dispose methods? In FP there isn't an event when page close. GC is smart enough to deal with almost all problems and you don't have to do manual reference counting. Check this article:enter link description here But let's left aside this. So in AS3 you don't have to nullify any of primitive types( String , Number , int , uint , Boolean ) nor arrays or vectors that holding it( when we speak for GC, If you want to free memory you can clear it and when FP or Air needs a memory the GC will collect it ). Calling array.length = 0 will truncate the array and the objects will be collected from GC ( if there isn;t another reference to it ).
Strings are immutable so if you have var of type string that holds some string and than assign to it null for example, the original string will remein until end of the program or it will be collected sometime