Symfony task - memory leak
问题 I wrote a symfony task to fill a database of sample data. Here's a sample piece of code: gc_enable(); Propel::disableInstancePooling(); public function test() { for($i = 0; $i < 10000; $i++) { $this->doIt($i); } } public function doIt($i) { $user = new User(); $user->setUsername('user' . $i . "@example.com"); $user->setPassword('test'); $user->setFirstName('firstname' . $i); $user->setLastName('surname' . rand(0, 1000)); $user->save(); $user->clearAllReferences(true); $user = null; gc_collect