PHP 8.5 introduces garbage collection optimizations that exclude enums and static fake closures (first-class callables) from cycle collection checks. These types cannot have cyclic references, so marking them as non-collectable prevents unnecessary GC runs. The improvement is particularly impactful when dealing with large numbers of first-class callables, reducing GC overhead from 44 runs to zero in benchmark tests with 10 million instances. The change demonstrates continued refinement of PHP's memory management system.
Sort: