http://php.net/gc

Memory cleanup for long-running scripts.

<?php
gc_enable
(); // Enable Garbage Collector
var_dump(gc_enabled()); // true
var_dump(gc_collect_cycles()); // # of elements cleaned up
gc_disable(); // Disable Garbage Collector
?>
Output
bool(true) int(585)