cphalcon: Memory leak on phalcon 3.0.0 and php 7.0

Memory leak (?) on phalcon 3.0.0 and php 7.0 when using relations between models.

class ModelA extends Model
{
    public function initialize()
    {
        $this->hasMany("id", "File", "a_id", array('alias' => 'files', 'reusable' => false));
    }
}

class File extends Model
{
    public function initialize()
    {
        $this->belongsTo('a_id', 'ModelA', 'id', array('alias' => 'a', 'reusable' => true));
    }
}
  • Phalcon version: 3.0.0
  • PHP Version: 7.0.9
  • Operating System: Ubuntu 16.04
  • Installation type: installing via package manager
  • Server: Nginx + php-fpm
$files = with $a->getFiles() // 2k records
echo memory_get_usage() // 164 MB
  • Phalcon version: 3.0.0
  • PHP Version: 5.5.9
  • Operating System: Ubuntu 14.04
  • Installation type: installing via package manager
  • Server: Nginx + php-fpm
$files = with $a->getFiles() // 2k records
echo memory_get_usage() // 5 MB

sometimes I got this error:

2016/08/10 12:06:11 [error] 3959#3959: *273 FastCGI sent in stderr: "PHP message: PHP Warning:  Uncaught ReflectionException: Property id does not exist in /home/projects/new/cache/views-compiled/%%home%%projects%%new%%app%%view%%template%%model%%details.volt.compiled:844
Stack trace:
#0 [internal function]: ReflectionClass->getProperty('id')
#1 [internal function]: Phalcon\Mvc\Model->_isVisible('id')
#2 [internal function]: Phalcon\Mvc\Model->__set('id', '35851878')
#3 [internal function]: Phalcon\Mvc\Model::cloneResultMap(Object(projects\Mvc\Model\File), Array, NULL, 0, true)
#4 /home/projects/new/cache/views-compiled/%%home%%projects%%new%%app%%view%%template%%model%%details.volt.compiled(844): Phalcon\Mvc\Model\Resultset\Simple->current()
#5 [internal function]: unknown()
#6 [internal function]: Phalcon\Mvc\View\Engine\Volt->render('../app/View/tem...', Array, true)
#7 [internal function]: Phalcon\Mvc\View->_engineRender(Array, 'model/details', true, true, NULL)
#8 /home/projects/new/app/Application.php(176): Phalcon\Mvc\View->render('model', 'details', Array)
#9 /home/projects/new/app/Ap...
PHP message: PHP Stack trace:
PHP message: PHP   1. {main}() /home/projects/new/public/index.php:0
PHP message: PHP   2. Phalcon\Application->handle() /home/projects/new/public/index.php:262
PHP message: PHP   3. Phalcon\Application->prepareResponse() /home/projects/new/app/Application.php:222
PHP message: PHP   4. Phalcon\Mvc\View->render() /home/projects/new/app/Application.php:176
PHP message: PHP   5. Phalcon\Mvc\View->_engineRender() /home/projects/new/app/Application.php:176
PHP message: PHP   6. Phalcon\Mvc\View\Engine\Volt->render() /home/projects/new/app/Application.php:176
PHP message: PHP   7. Phalcon\Mvc\View\Engine\Volt->render() /home/projects/new/app/Application.php:176
PHP message: PHP   8. Phalcon\Mvc\Model\Resultset\Simple->current() /home/projects/new/cache/views-compiled/%%home%%projects%%new%%app%%view%%template%%model%%details.volt.compiled:844
PHP message: PHP   9. Phalcon\Mvc\Model::cloneResultMap() /home/projects/new/cache/views-compiled/%%home%%projects%%new%%ap

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (18 by maintainers)

Most upvoted comments

After adding all properties in model – no more problems with memory. https://github.com/phalcon/cphalcon/issues/12115#issuecomment-238816825

But why is no such problem in php 5?