{"action":"created","issue":{"url":"https://api.github.com/repos/phpmetrics/PhpMetrics/issues/188","repository_url":"https://api.github.com/repos/phpmetrics/PhpMetrics","labels_url":"https://api.github.com/repos/phpmetrics/PhpMetrics/issues/188/labels{/name}","comments_url":"https://api.github.com/repos/phpmetrics/PhpMetrics/issues/188/comments","events_url":"https://api.github.com/repos/phpmetrics/PhpMetrics/issues/188/events","html_url":"https://github.com/phpmetrics/PhpMetrics/issues/188","id":137027916,"number":188,"title":"Allowed memory size of XXX bytes exhausted","user":{"login":"infectormp","id":9958813,"avatar_url":"https://avatars.githubusercontent.com/u/9958813?v=3","gravatar_id":"","url":"https://api.github.com/users/infectormp","html_url":"https://github.com/infectormp","followers_url":"https://api.github.com/users/infectormp/followers","following_url":"https://api.github.com/users/infectormp/following{/other_user}","gists_url":"https://api.github.com/users/infectormp/gists{/gist_id}","starred_url":"https://api.github.com/users/infectormp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infectormp/subscriptions","organizations_url":"https://api.github.com/users/infectormp/orgs","repos_url":"https://api.github.com/users/infectormp/repos","events_url":"https://api.github.com/users/infectormp/events{/privacy}","received_events_url":"https://api.github.com/users/infectormp/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phpmetrics/PhpMetrics/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-02-28T08:51:14Z","updated_at":"2016-03-22T20:56:54Z","closed_at":"2016-03-20T21:21:07Z","body":"Get some memory size error when scan code. I try it with different memory_limit.\r\n\r\nAllowed memory size of 268435456 bytes exhausted (tried to allocate 528384 bytes) in phar:///usr/local/bin/phpmetrics/src/Hal/Component/Token/TokenCollection.php on line 118\r\n\r\nAllowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in phar:///usr/local/bin/phpmetrics/src/Hal/Component/Token/TokenCollectionCompatibility.php on line 56\r\n\r\nAllowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in phar:///usr/local/bin/phpmetrics/src/Hal/Component/Token/TokenCollectionCompatibility.php on line 34\r\n\r\nWant suggest add option to ignore files by size ```--max-size```"},"comment":{"url":"https://api.github.com/repos/phpmetrics/PhpMetrics/issues/comments/200021914","html_url":"https://github.com/phpmetrics/PhpMetrics/issues/188#issuecomment-200021914","issue_url":"https://api.github.com/repos/phpmetrics/PhpMetrics/issues/188","id":200021914,"user":{"login":"pavarnos","id":589595,"avatar_url":"https://avatars.githubusercontent.com/u/589595?v=3","gravatar_id":"","url":"https://api.github.com/users/pavarnos","html_url":"https://github.com/pavarnos","followers_url":"https://api.github.com/users/pavarnos/followers","following_url":"https://api.github.com/users/pavarnos/following{/other_user}","gists_url":"https://api.github.com/users/pavarnos/gists{/gist_id}","starred_url":"https://api.github.com/users/pavarnos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavarnos/subscriptions","organizations_url":"https://api.github.com/users/pavarnos/orgs","repos_url":"https://api.github.com/users/pavarnos/repos","events_url":"https://api.github.com/users/pavarnos/events{/privacy}","received_events_url":"https://api.github.com/users/pavarnos/received_events","type":"User","site_admin":false},"created_at":"2016-03-22T20:56:53Z","updated_at":"2016-03-22T20:56:53Z","body":"I've spent a bit of time reading the code (which it beautiful btw!)\r\n\r\nsrc/Hal/Application/Command/RunMetricsCommand.php does\r\n```php\r\n        gc_disable();\r\n        $queue->execute($collection, $aggregatedResults);\r\n        gc_enable();\r\n```\r\n\r\nIs this for performance?\r\nI'm not sure what you have tried... but i wonder if this is the cause of the large memory consumption. Blackfire may tell you in detail...\r\n\r\nOne possible (naive) solution is to make it optional. Eg just before the end of QueueFactory::factory() decorate the queue, \r\n```php\r\n   if ($this->config->fastModeSelected()) {\r\n        $queue = new FastQueue();\r\n   } else {\r\n        $queue = new Queue();\r\n   }\r\n```\r\n\r\nwhere \r\n```php\r\nclass FastQueue extends Queue {\r\n    public function execute(ResultCollection $collection, ResultCollection $aggregatedResults) {\r\n        foreach($this->jobs as $job) {\r\n            gc_disable();\r\n            $job->execute($collection, $aggregatedResults);\r\n            gc_collect_cycles();\r\n            gc_enable();\r\n        }\r\n    }\r\n````"}}