Quantcast
Channel: ActionScript - Difference Between Primitive / Non-Primitive Objects for Memory Management? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

ActionScript - Difference Between Primitive / Non-Primitive Objects for Memory Management?

$
0
0

my understanding is that primitive types (uint, string, Number, etc.) of a class do not need to be set to null for garbage collection.

for example, i am not required to write this dispose() method in the following class:

package{//Importsimport flash.display.Shape;//Classpublic class DrawSquare extends Shape    {    //Properties    private var squareColorProperty:uint;    //Constructor    public function DrawSquare(squareColor:uint)        {        squareColorProperty = squareColor;        init();        }    //Initialize    private function init():void        {        graphics.beginFill(shapeColorProperty);        graphics.drawRect(0, 0, 200, 200);        graphics.endFill();        }    //Dispose    public function dispose():void        {        squareColorProperty = null;        }    //Get Shape Color    public function get squareColor():uint;        {        return squareColorProperty;        }    }}

if this is true, which i believe it is, what is the difference between objects of primitive types and objects of non primitive types concerning memory allocation?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>