I was doing some experimenting to see whether having multiple references to a string took up much space, and it turns out that Flash doesn’t actually deep-copy strings when you copy them around. Instead it copies by reference until a change is made, which then forces a deep copy. This is similar to the way PHP works, passing strings by value but not actually creating a new object until the value is changed. Below is the code I used to determine this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |