So, I tried to play this sample
http://www.doctrine-project.org/blog/doctrine2-batch-processing
class HelloWorldCommand extends DoctrineCommand
{
protected function configure()
{
$this
->setName('hello:world')
->setDescription('hello world')
->setHelp(<<<EOT
nothing here
EOT
);
}
protected function execute(InputInterface $input, OutputInterface
$output)
{
echo memory_get_usage(), "\n";
$em = $this->getDoctrineEntityManagers();
$em = $em[0];
ini_set('memory_limit', '128M');
$batchSize = 20;
$iterations = 10000;
for ($i = 1; $i <= $iterations; $i++) {
/*
* simple entity without relations (2 varchars, 3
integers)
*/
$region = new Region();
$region->setTitle('Hello World!');
$em->persist($region);
if (($i % $batchSize) == 0) {
$em->flush();
$em->clear();
}
}
//gc_collect_cycles();
echo memory_get_usage(), "\n";
}
}
the output is:
5574180
31335260
and then i uncomment gc_collect_cycles():
5574584
31328500
31335260 - 31328500 = 6760 (!!!)
So... where all the memory goes?
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en