An application runs until the heap is exhausted of free memory, at which point the GC stops all application code, performs a garbage collect, and then lets the application continue. 应用程序一直运行,直至耗尽堆的可用内存,此时GC停止所有的应用程序代码、执行垃圾收集(GC),然后让应用程序继续运行。
PHP has a pretty simple garbage collector, which basically will garbage collect an object when it no longer is in scope. PHP有一个非常简单的垃圾收集(GC)器,它实际上将对不再位于内存范围(scope)中的对象进行垃圾收集(GC)。
This configuration provides a balance between how often the garbage collector runs and how long it takes the garbage collector to collect garbage. 此配置在垃圾回收器运行的频率和垃圾回收器进行垃圾回收操作的时间长度之间进行了平衡。
If the heap is close to the memory usage of the application, the garbage collector has to collect the heap too often, and performance suffers. 如果堆和应用程序的内存使用量很接近,那么垃圾收集(GC)器必须非常频繁地收集堆,这会导致性能损失。
It is possible to force garbage collection by calling collect, but most of the time, this should be avoided because it may create performance issues. 可以通过调用collect强制进行垃圾回收,但大多数情况下应避免这样做,因为这样会导致性能问题。