Hello.
I'm having simple test entity:
> class test
> {
> /**
> * @var integer $id
> */
> private $id;
>
> /**
> * @var string $test
> */
> private $test;
>
> // get/set methods
> }
>
and command:
> protected function execute(InputInterface $input, OutputInterface
> $output) {
>
> $doctrine = $this -> getContainer() -> get('doctrine');
> /* @var $doctrine \Symfony\Bundle\DoctrineBundle\Registry */
>
> $em = $doctrine -> getEntityManager();
> /* @var $em \Doctrine\ORM\EntityManager */
> $em -> getconfiguration() -> setSQLLogger(null);
>
>
> $mem_start = memory_get_usage();
> gc_collect_cycles();
> for ($i = 1; $i < 1000; $i++) {
> $test = new Test();
> $test -> setTest(str_repeat('xy', 100));
>
> $em -> persist($test);
>
>
>
> if ($i % 50 == 0) {
> $em -> flush($test);
> $em -> clear();
> gc_collect_cycles();
> echo sprintf('%06d', $i).": ";
> echo number_format(memory_get_usage() - $mem_start)."\n";
> }
> }
> }
>
after execution of this command output looks like this:
> 000050: 2,204,656
> 000100: 2,334,232
> 000150: 2,464,576
> 000200: 2,593,384
> 000250: 2,722,192
> 000300: 2,854,072
> 000350: 2,982,880
> 000400: 3,111,688
> 000450: 3,240,496
> 000500: 3,369,304
> 000550: 3,504,256
> 000600: 3,665,832
> 000650: 3,794,640
> 000700: 3,923,448
> 000750: 4,052,256
> 000800: 4,181,064
> 000850: 4,309,872
> 000900: 4,438,680
> 000950: 4,567,488
>
so after inserting 1000 rows memory usage incrased for almost 5mb!
So i tried to ommit using entityManager:
> protected function execute(InputInterface $input, OutputInterface $output)
> {
>
> $doctrine = $this -> getContainer() -> get('doctrine');
> /* @var $doctrine \Symfony\Bundle\DoctrineBundle\Registry */
>
> $em = $doctrine -> getEntityManager();
> /* @var $em \Doctrine\ORM\EntityManager */
> $em -> getconfiguration() -> setSQLLogger(null);
>
>
> $connection = $doctrine -> getConnection();
> /* @var $connection \Doctrine\DBAL\Connection */
>
> $mem_start = memory_get_usage();
> gc_collect_cycles();
> for ($i = 1; $i < 1000; $i++) {
>
> $connection -> insert('test', array (
> 'test' => str_repeat('xy', 100)));
>
>
> if ($i % 50 == 0) {
> gc_collect_cycles();
> echo sprintf('%06d', $i).": ";
> echo number_format(memory_get_usage() - $mem_start)."\n";
> }
> }
> }
>
But output is like this:
> 000050: 279,744
> 000100: 417,712
> 000150: 556,448
> 000200: 693,648
> 000250: 830,848
> 000300: 971,120
> 000350: 1,108,320
> 000400: 1,245,520
> 000450: 1,382,720
> 000500: 1,519,920
> 000550: 1,663,264
> 000600: 1,800,464
> 000650: 1,937,664
> 000700: 2,107,632
> 000750: 2,244,832
> 000800: 2,382,032
> 000850: 2,519,232
> 000900: 2,656,432
> 000950: 2,793,632
>
Twice less but still no good.
Any 1 knows what should I do to get rid of these memory leaks? Mb it's just
some bug that should be reported?
My configuration: Windows XP 32 bit / server: xampp xampp-win32-1.7.7-VC9
--
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 developers" 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-devs?hl=en