{"action":"closed","issue":{"url":"https://api.github.com/repos/raquo/Airstream/issues/10","repository_url":"https://api.github.com/repos/raquo/Airstream","labels_url":"https://api.github.com/repos/raquo/Airstream/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/raquo/Airstream/issues/10/comments","events_url":"https://api.github.com/repos/raquo/Airstream/issues/10/events","html_url":"https://github.com/raquo/Airstream/issues/10","id":367411638,"node_id":"MDU6SXNzdWUzNjc0MTE2Mzg=","number":10,"title":"Bug: Observable.removeObserver can cause a (usually minor) memory leak","user":{"login":"raquo","id":532656,"node_id":"MDQ6VXNlcjUzMjY1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/532656?v=4","gravatar_id":"","url":"https://api.github.com/users/raquo","html_url":"https://github.com/raquo","followers_url":"https://api.github.com/users/raquo/followers","following_url":"https://api.github.com/users/raquo/following{/other_user}","gists_url":"https://api.github.com/users/raquo/gists{/gist_id}","starred_url":"https://api.github.com/users/raquo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raquo/subscriptions","organizations_url":"https://api.github.com/users/raquo/orgs","repos_url":"https://api.github.com/users/raquo/repos","events_url":"https://api.github.com/users/raquo/events{/privacy}","received_events_url":"https://api.github.com/users/raquo/received_events","type":"User","site_admin":false},"labels":[{"id":901182289,"node_id":"MDU6TGFiZWw5MDExODIyODk=","url":"https://api.github.com/repos/raquo/Airstream/labels/bug","name":"bug","color":"d73a4a","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-06T01:32:49Z","updated_at":"2018-11-04T03:04:16Z","closed_at":"2018-11-04T03:04:16Z","author_association":"OWNER","body":"Adding an Observer to an Observable requires you provide an Owner, and produces a Subscription. Normally the owner should take care of killing this subscription, but you can also kill it manually before the owner decides to do that.\r\n\r\nThe right way to do this is to call `subscription.kill()`.\r\n\r\nHowever, Airstream also provides a `removeObserver(observer)` method on Observable. While it does correctly remove the observer from the observable, it does not call `subsription.kill()` because it has no reference to the subscription. This means the Owner continues to keep a reference to the subscription (and thus to both observable and observer) until the Owner decides to kill them.\r\n\r\nThis is an error in my API design, and is contrary to users expectations. I will fix this one way or another, likely by removing the removeObserver method. However, the exact solution depends on how I decide to implement https://github.com/raquo/Laminar/issues/33.\r\n\r\nFor now, avoid using the removeObserver method in favour of subscription.kill"}}
{"actor":{"display_login":"raquo"}}