{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/26654","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/26654/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/26654/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/26654/events","html_url":"https://github.com/dart-lang/sdk/issues/26654","id":159191137,"number":26654,"title":"Memory leak when using countdown timer","user":{"login":"dustinlessard-wf","id":2326518,"avatar_url":"https://avatars.githubusercontent.com/u/2326518?v=3","gravatar_id":"","url":"https://api.github.com/users/dustinlessard-wf","html_url":"https://github.com/dustinlessard-wf","followers_url":"https://api.github.com/users/dustinlessard-wf/followers","following_url":"https://api.github.com/users/dustinlessard-wf/following{/other_user}","gists_url":"https://api.github.com/users/dustinlessard-wf/gists{/gist_id}","starred_url":"https://api.github.com/users/dustinlessard-wf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dustinlessard-wf/subscriptions","organizations_url":"https://api.github.com/users/dustinlessard-wf/orgs","repos_url":"https://api.github.com/users/dustinlessard-wf/repos","events_url":"https://api.github.com/users/dustinlessard-wf/events{/privacy}","received_events_url":"https://api.github.com/users/dustinlessard-wf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/sdk/labels/area-dartium","name":"area-dartium","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-08T15:18:29Z","updated_at":"2016-06-08T17:58:16Z","closed_at":null,"body":"When we do something like :\r\n```dart\r\nvoid doSomething {\r\nnew Timer(delay, () {\r\n        this.doSomethingElse();\r\n        doOtherThings();\r\n      });\r\n}\r\n```\r\nWe expect the callback function to execute once, then the Timer becomes available for garbage collection.  This isn't the case.  In addition, the object where we execute `doSomethingElse` is also not eligible for garbage collection.\r\n\r\nThis was tested in Dartium by doing:\r\n```dart\r\ncustomTimer = new Timer(delay, () {\r\n        this.doSomethingElse();\r\n        doOtherThings();\r\n      });\r\n\r\ndeveloper.inspect(customTimer);\r\n\r\n```\r\nAnd then checking the retaining path on the timer:\r\n\r\n![screen shot 2016-06-08 at 11 17 00 am](https://cloud.githubusercontent.com/assets/2326518/15899680/8e69a5d8-2d6a-11e6-8ba6-c218e3334c4a.png)\r\n\r\n\r\nA workaround has been to explicitly call `cancel` on the timer, after the callback function has executed (but not within the callback function itself), but this seems like something that should have happened automatically?"},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/224675516","html_url":"https://github.com/dart-lang/sdk/issues/26654#issuecomment-224675516","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/26654","id":224675516,"user":{"login":"alan-knight","id":3476088,"avatar_url":"https://avatars.githubusercontent.com/u/3476088?v=3","gravatar_id":"","url":"https://api.github.com/users/alan-knight","html_url":"https://github.com/alan-knight","followers_url":"https://api.github.com/users/alan-knight/followers","following_url":"https://api.github.com/users/alan-knight/following{/other_user}","gists_url":"https://api.github.com/users/alan-knight/gists{/gist_id}","starred_url":"https://api.github.com/users/alan-knight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alan-knight/subscriptions","organizations_url":"https://api.github.com/users/alan-knight/orgs","repos_url":"https://api.github.com/users/alan-knight/repos","events_url":"https://api.github.com/users/alan-knight/events{/privacy}","received_events_url":"https://api.github.com/users/alan-knight/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T17:58:16Z","updated_at":"2016-06-08T17:58:16Z","body":"There are definitely known memory leaks in Dartium with the conversion to using JS Interop. It does seem like these should only arise if using operations that end up calling out to JS. But it's possible that Timers do in the browser?  Does this affect dart2js, or is it purely a Dartium problem. If so, unless it's enough of a problem to make development difficult, we'd probably consider it a lower priority.  @terrylucas "}}
{"actor":{"display_login":"alan-knight"}}