{"action":"closed","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/1454","labels_url":"https://api.github.com/repos/facebook/react-native/issues/1454/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/1454/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/1454/events","html_url":"https://github.com/facebook/react-native/issues/1454","id":82674187,"number":1454,"title":"[Perf] Memory leak with requestAnimationFrame and named anonymous function","user":{"login":"jessepollak","id":1097953,"avatar_url":"https://avatars.githubusercontent.com/u/1097953?v=3","gravatar_id":"","url":"https://api.github.com/users/jessepollak","html_url":"https://github.com/jessepollak","followers_url":"https://api.github.com/users/jessepollak/followers","following_url":"https://api.github.com/users/jessepollak/following{/other_user}","gists_url":"https://api.github.com/users/jessepollak/gists{/gist_id}","starred_url":"https://api.github.com/users/jessepollak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessepollak/subscriptions","organizations_url":"https://api.github.com/users/jessepollak/orgs","repos_url":"https://api.github.com/users/jessepollak/repos","events_url":"https://api.github.com/users/jessepollak/events{/privacy}","received_events_url":"https://api.github.com/users/jessepollak/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react-native/labels/Icebox","name":"Icebox","color":"bfd4f2"}],"state":"closed","locked":false,"assignee":{"login":"tadeuzagallo","id":764414,"avatar_url":"https://avatars.githubusercontent.com/u/764414?v=3","gravatar_id":"","url":"https://api.github.com/users/tadeuzagallo","html_url":"https://github.com/tadeuzagallo","followers_url":"https://api.github.com/users/tadeuzagallo/followers","following_url":"https://api.github.com/users/tadeuzagallo/following{/other_user}","gists_url":"https://api.github.com/users/tadeuzagallo/gists{/gist_id}","starred_url":"https://api.github.com/users/tadeuzagallo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tadeuzagallo/subscriptions","organizations_url":"https://api.github.com/users/tadeuzagallo/orgs","repos_url":"https://api.github.com/users/tadeuzagallo/repos","events_url":"https://api.github.com/users/tadeuzagallo/events{/privacy}","received_events_url":"https://api.github.com/users/tadeuzagallo/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-05-30T02:50:28Z","updated_at":"2016-01-02T02:09:56Z","closed_at":"2016-01-02T02:09:56Z","body":"In a component I've created, I am doing an animation that uses recursion and `window.requestAnimationFrame`. The following code snippet causes this memory leak:\r\n\r\n```javascript\r\nvar _animation = () => {\r\n    window.requestAnimationFrame(_animation)\r\n}\r\n```\r\n\r\n**EDIT: This fix doesn't work. It just causes the code to crash which I somehow missed (but fixes the leak, lol).**\r\n\r\n~~Now, if we remove the `var` and put the named anonymous function in the global scope...~~\r\n\r\n```javascript\r\n_animation = () => {\r\n    window.requestAnimationFrame(_animation)\r\n}\r\n```\r\n\r\n~~Voila, the leak goes away!~~\r\n\r\nNo idea how to start digging into this one. Let me know if there's any other information I can provide.\r\n\r\nThanks y'all for all of your hard work :)"}}