We declare a string variable like var _variable:String="xyz"; var _variable1:String=new String("xyz"); So i want to know what is difference between those string variables in terms of memory allocation or both have the same allocation.
A:
I am not certain, but I would be willing to bet that they take up the exact same amount of memory. It is two ways of doing the same thing, the result will be an identical string object.
That said, the execution costs could be different. In other words, one may execute faster than the other, but the end result would be the same. var _variable:String = 'xyz'; would probably be faster, but the difference is probably very minimal.
In any case, if you have flex builder professional, you can use the profiler to find out exactly how much memory the instance is taking up and compare.
Ryan Guill
2010-02-22 17:13:02