Traditionally, the reference counting memory mechanism used by php in the past cannot handle cyclic reference memory leakage. However, 5.3.0 & amp; nbsp; PHP & amp; nbsp; use the synchronization algorithm in ConcurrentCycleCollectioninReferenceCountedSystems in the reference counting system to handle this memory leakage problem. The complete description of the algorithm is a bit out of the scope of this part. we will only introduce the basic part. First, we need to first establish a reference counting memory mechanism like previously used by php, which cannot handle loop reference memory leakage. However, 5.3.0 PHP uses the article» Reference the synchronization algorithm in the count system (Concurrent Cycle Collection in Reference Counted Systems) to handle this memory leakage problem. The complete description of the algorithm is a bit out of the scope of this part. we will only introduce the basic part. First, we need to establish some basic rules. if a reference count increases, it will continue to be used, and of course it will not be in the garbage. If the reference count is reduced to zero, the variable container is cleared (free ). That is to say, garbage cycle is generated only when the reference count is reduced to a non-zero value ). Second, in a garbage cycle, check whether the reference count is reduced by 1, and check which variable containers reference zero times to find which part is garbage. The above is the garbage collection mechanism 2, which is characteristic of PHP. For more information, see
1. garbage collection mechanism based on PHP features 2-collection cycle
Brief introduction: garbage collection mechanism with PHP features-recycling cycle
3. collection cycle of PHP garbage collection mechanism
Introduction: This article mainly introduces the collection cycle of the PHP garbage collection mechanism. if you are interested in the PHP Tutorial, please refer to it.
The above is a detailed description of 3 articles recommended for the recycling cycle. For more information, see other related articles in the first PHP community!