Memory leaks #2

Merged
merged 2 commits into from Aug 5, 2011

Projects

None yet

2 participants

@vatson
vatson commented Aug 5, 2011

Overview Description

Large memory leaks are visible at short intervals iteration

Steps

  1. Setup bundle to the application;
  2. Replace CodeMeme\Bundle\CodeMemeDaemonBundle\Command\ExampleStartCommand::execute on:
<?php

    protected function execute(InputInterface $input, OutputInterface $output)
    {
      $daemon = new Daemon($this->container->getParameter('example.daemon.options'));
      $daemon->setInterval(0.001);
      $daemon->start();

      while ($daemon->isRunning()) {
          //$this->container->get('example.control')->run();
      }

      $daemon->stop();
    }
  1. Run command:
./app/console example:stop
  1. Run top(or another activity monitor) and see results;

Actual Results

Occupied memory is growing at 500kb per minute at an interval of 100 ms

Expected Results

No leakage

Platforms Tested On

Mac OS X
Darwin vatson-2.local 11.0.0 Darwin Kernel Version 11.0.0: Sat Jun 18 12:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64 x86_64

PHP
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Additional Information

I found a reason. System_Daemon::setOptions in the Daemon::isRunning method causes memory leaks. I can not understand why we update the parameters at each iteration.

@jessegreathouse
Member

thanks for fixing this. I merged your pull request.

@jessegreathouse jessegreathouse merged commit 0c050e3 into CodeMeme:master Aug 5, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment