{"action":"created","issue":{"url":"https://api.github.com/repos/grevory/angular-local-storage/issues/324","repository_url":"https://api.github.com/repos/grevory/angular-local-storage","labels_url":"https://api.github.com/repos/grevory/angular-local-storage/issues/324/labels{/name}","comments_url":"https://api.github.com/repos/grevory/angular-local-storage/issues/324/comments","events_url":"https://api.github.com/repos/grevory/angular-local-storage/issues/324/events","html_url":"https://github.com/grevory/angular-local-storage/pull/324","id":173542066,"number":324,"title":"prevent memory leak by removing listeners on the window","user":{"login":"loftyduck","id":6843000,"avatar_url":"https://avatars.githubusercontent.com/u/6843000?v=3","gravatar_id":"","url":"https://api.github.com/users/loftyduck","html_url":"https://github.com/loftyduck","followers_url":"https://api.github.com/users/loftyduck/followers","following_url":"https://api.github.com/users/loftyduck/following{/other_user}","gists_url":"https://api.github.com/users/loftyduck/gists{/gist_id}","starred_url":"https://api.github.com/users/loftyduck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loftyduck/subscriptions","organizations_url":"https://api.github.com/users/loftyduck/orgs","repos_url":"https://api.github.com/users/loftyduck/repos","events_url":"https://api.github.com/users/loftyduck/events{/privacy}","received_events_url":"https://api.github.com/users/loftyduck/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-26T20:56:37Z","updated_at":"2016-08-30T03:04:39Z","closed_at":"2016-08-26T21:42:25Z","pull_request":{"url":"https://api.github.com/repos/grevory/angular-local-storage/pulls/324","html_url":"https://github.com/grevory/angular-local-storage/pull/324","diff_url":"https://github.com/grevory/angular-local-storage/pull/324.diff","patch_url":"https://github.com/grevory/angular-local-storage/pull/324.patch"},"body":"I am using this library in a project that has about 2500 unit tests written with Jasmine and run via karma, grunt and PhantomJS.  After upgrading the library to v0.2.8 (from v0.1.3) there was significantly more memory consumed by PhantomJS - it went from to 250MB to over 1GB therefore causing PhantomJS to crash.\r\n\r\nI was able to track the issue down to these few lines of code:\r\nThe handleStorageChangeCallback has a reference to $rootScope in order to broadcast the event.  Therefore when $rootScope is destroyed it will remain in memory unless the listener is removed from the $window. \r\n\r\nI can provide more detail if needed, just let me know"},"comment":{"url":"https://api.github.com/repos/grevory/angular-local-storage/issues/comments/243320121","html_url":"https://github.com/grevory/angular-local-storage/pull/324#issuecomment-243320121","issue_url":"https://api.github.com/repos/grevory/angular-local-storage/issues/324","id":243320121,"user":{"login":"iHazCode","id":5432500,"avatar_url":"https://avatars.githubusercontent.com/u/5432500?v=3","gravatar_id":"","url":"https://api.github.com/users/iHazCode","html_url":"https://github.com/iHazCode","followers_url":"https://api.github.com/users/iHazCode/followers","following_url":"https://api.github.com/users/iHazCode/following{/other_user}","gists_url":"https://api.github.com/users/iHazCode/gists{/gist_id}","starred_url":"https://api.github.com/users/iHazCode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iHazCode/subscriptions","organizations_url":"https://api.github.com/users/iHazCode/orgs","repos_url":"https://api.github.com/users/iHazCode/repos","events_url":"https://api.github.com/users/iHazCode/events{/privacy}","received_events_url":"https://api.github.com/users/iHazCode/received_events","type":"User","site_admin":false},"created_at":"2016-08-30T03:04:39Z","updated_at":"2016-08-30T03:04:39Z","body":"Excellent find and corresponding update! Thankfully this was found during Test Suite execution, this would have a been even more tricky to pinpoint if it was the eengine choking on a larger project (which would inevitably happen).\r\n\r\nThis will go a long way towards championing practical use of the lib with mid to larger sized projects. Considering the level of potential orphaned listeners (based on usage) could quickly rise at an exponential rate if used with foundation piece widgets and/or first class controls.  \r\n\r\nWay to go!"}}
{"actor":{"display_login":"iHazCode"}}