php - Reassigning an array frees the memory used by it? -
There are a member variable array in my class, from time to time I have the array as the value of the second, floating array Reassign, such as:
$ temp = array (); $ Temp [] = new object (); $ Temp [] = new object (); $ Temp [] = new object (); ... etc $ $ - this- & gt; Item = $ temp;
So, can I have a memory leak? $ $ Value - $ temporarily awkward, or will they be free - $ temporarily by reallocating a new value, temporarily reassigning $ all items (item items)?
This will not cause the memory leak. $ Temp and $ the-> items are only references to the same array since PHP is a garbage collective language, the array will be removed (garbage collected) when there will be no reference to an array.
Comments
Post a Comment