therefore I use php 5.2 and need garbage collection, as I deal with very limited resources and large data sets.
from my tests, I saw that unset does nothing until the end of the script (even if I run out of memory), which is a little contrary to the documentation, although I assume that I also read 5.3 Documents, not 5.2 documents, and 5.3 documents look relatively undocumented .
An example of my class’s barebones looks like this:
class foo{
private $_var;
public function __construct(){
$this->_var = array();
for($i = 0; $i < 10000000000; $i++){
$this->_var[rand(1, 100000)] = 'I am string '.$i.' in the array';
}
}
public function myGC(){
$this->_var = null;
}
}
"myGC()" foreach , , NULL ( , ++), $this → _ var = NULL, , , ?