Traditionally, the reference-count memory mechanism, like the previous PHP, could not handle circular reference memory leaks. However 5.3.0 PHP uses the synchronization algorithm in the article» Reference counting system for synchronization cycle recovery (Concurrent cycle Collection in Reference counted systems) to handle this memory leak problem. The full description of the algorithm is somewhat beyond the scope of this section and will only cover the underlying part. First, we have to establish some basic rules, if a reference count increases, it will continue to be used, of course, it is no longer in the garbage. If the reference count is reduced to zero, the container in which the variable is located is cleared (free). That is, the garbage cycle (garbage cycle) is generated only when the reference count is reduced to a value other than 0. Second, in a garbage cycle, by checking whether the reference count is minus 1, and checking which variable containers have a reference number of zero, to find out which part is garbage. The above is the PHP characteristics of the garbage collection mechanism 2--recovery cycle content, more relevant content please focus on PHP
1. PHP features garbage collection mechanism 2--recovery cycle
Summary: Traditionally, the reference count memory mechanism, like the previous PHP, cannot handle circular reference memory leaks. However 5.3.0 PHP uses the synchronization algorithm in the article» Reference counting system for synchronization cycle recovery (Concurrent cycle Collection in Reference counted systems) to handle this memory leak problem.
2. PHP garbage collection mechanism-recycle cycle
Introduction: PHP features garbage collection mechanism-recycling cycle
3. Recycle period of PHP garbage collection mechanism
Introduction:: This article mainly introduces the garbage collection mechanism of PHP recycling cycle, for the PHP tutorial interested students can refer to.