As with PHP 5.3, you can explicitly start the GC cycle with gc_collect_cycles() , as described here .
Before that, it was out of your control, and you would have to wait until PHP decided that it was time to take out the garbage on its own - either trying to exceed the memory limit with a significant amount of used but not attached memory objects or sacrificing a goat under the full moon and hoping for the best.
source share