{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/hhvm/issues/7071","repository_url":"https://api.github.com/repos/facebook/hhvm","labels_url":"https://api.github.com/repos/facebook/hhvm/issues/7071/labels{/name}","comments_url":"https://api.github.com/repos/facebook/hhvm/issues/7071/comments","events_url":"https://api.github.com/repos/facebook/hhvm/issues/7071/events","html_url":"https://github.com/facebook/hhvm/issues/7071","id":155262423,"number":7071,"title":"Memory leak when using += operator.","user":{"login":"Norbyte","id":2243424,"avatar_url":"https://avatars.githubusercontent.com/u/2243424?v=3","gravatar_id":"","url":"https://api.github.com/users/Norbyte","html_url":"https://github.com/Norbyte","followers_url":"https://api.github.com/users/Norbyte/followers","following_url":"https://api.github.com/users/Norbyte/following{/other_user}","gists_url":"https://api.github.com/users/Norbyte/gists{/gist_id}","starred_url":"https://api.github.com/users/Norbyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Norbyte/subscriptions","organizations_url":"https://api.github.com/users/Norbyte/orgs","repos_url":"https://api.github.com/users/Norbyte/repos","events_url":"https://api.github.com/users/Norbyte/events{/privacy}","received_events_url":"https://api.github.com/users/Norbyte/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/hhvm/labels/memory%20leak","name":"memory leak","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-05-17T13:41:34Z","updated_at":"2016-06-29T17:14:12Z","closed_at":"2016-06-29T17:14:12Z","body":"HHVM leaks memory when concatenating arrays using the += operator.\r\n\r\nHipHop VM 3.12.2-dev (rel)\r\nCompiler: remotes/origin/HHVM-3.12-0-g3b4d6db0f24236fddcd8c9313f9f8bf6f2c72f09\r\nRepo schema: 5107bad6d6910a4bc292ad2910a6b5a39dc94f6d\r\n\r\nAffected code:\r\n```\r\nfor ($i = 0; $i < 100; $i++)\r\n{   \r\n    $a = [];\r\n    $a += [str_repeat('x', 1000000)];\r\n    echo memory_get_usage(true) . PHP_EOL;\r\n}\r\n```\r\n\r\nOutput:\r\n```\r\n2152872\r\n3201496\r\n4250104\r\n5298744\r\n6347352\r\n7395960\r\n[...]\r\n```\r\n\r\nIf I replace `$a += [str_repeat('x', 1000000)];` by `$a = $a + [str_repeat('x', 1000000)];` or `array_merge`, memory usage doesn't grow anymore:\r\n```\r\n2152872\r\n2152872\r\n2152872\r\n2152872\r\n2152872\r\n[...]\r\n```"},"comment":{"url":"https://api.github.com/repos/facebook/hhvm/issues/comments/229424406","html_url":"https://github.com/facebook/hhvm/issues/7071#issuecomment-229424406","issue_url":"https://api.github.com/repos/facebook/hhvm/issues/7071","id":229424406,"user":{"login":"Orvid","id":709247,"avatar_url":"https://avatars.githubusercontent.com/u/709247?v=3","gravatar_id":"","url":"https://api.github.com/users/Orvid","html_url":"https://github.com/Orvid","followers_url":"https://api.github.com/users/Orvid/followers","following_url":"https://api.github.com/users/Orvid/following{/other_user}","gists_url":"https://api.github.com/users/Orvid/gists{/gist_id}","starred_url":"https://api.github.com/users/Orvid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Orvid/subscriptions","organizations_url":"https://api.github.com/users/Orvid/orgs","repos_url":"https://api.github.com/users/Orvid/repos","events_url":"https://api.github.com/users/Orvid/events{/privacy}","received_events_url":"https://api.github.com/users/Orvid/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T17:14:12Z","updated_at":"2016-06-29T17:14:12Z","body":"Yep, there was an issue like this that got fixed. Closing."}}
{"actor":{"display_login":"Orvid"}}