{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/2334","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/2334/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/2334/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/2334/events","html_url":"https://github.com/mapbox/mapbox-gl-native/pull/2334","id":106643989,"number":2334,"title":"use std::unique_ptr for NodeMap resources","user":{"login":"mikemorris","id":1149913,"avatar_url":"https://avatars.githubusercontent.com/u/1149913?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemorris","html_url":"https://github.com/mikemorris","followers_url":"https://api.github.com/users/mikemorris/followers","following_url":"https://api.github.com/users/mikemorris/following{/other_user}","gists_url":"https://api.github.com/users/mikemorris/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemorris/subscriptions","organizations_url":"https://api.github.com/users/mikemorris/orgs","repos_url":"https://api.github.com/users/mikemorris/repos","events_url":"https://api.github.com/users/mikemorris/events{/privacy}","received_events_url":"https://api.github.com/users/mikemorris/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/in%20progress","name":"in progress","color":"ededed"},{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/node","name":"node","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"mikemorris","id":1149913,"avatar_url":"https://avatars.githubusercontent.com/u/1149913?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemorris","html_url":"https://github.com/mikemorris","followers_url":"https://api.github.com/users/mikemorris/followers","following_url":"https://api.github.com/users/mikemorris/following{/other_user}","gists_url":"https://api.github.com/users/mikemorris/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemorris/subscriptions","organizations_url":"https://api.github.com/users/mikemorris/orgs","repos_url":"https://api.github.com/users/mikemorris/repos","events_url":"https://api.github.com/users/mikemorris/events{/privacy}","received_events_url":"https://api.github.com/users/mikemorris/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones/14","html_url":"https://github.com/mapbox/mapbox-gl-native/milestones/node-v2.0.0","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/milestones/14/labels","id":1286998,"number":14,"title":"node-v2.0.0","description":"","creator":{"login":"mikemorris","id":1149913,"avatar_url":"https://avatars.githubusercontent.com/u/1149913?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemorris","html_url":"https://github.com/mikemorris","followers_url":"https://api.github.com/users/mikemorris/followers","following_url":"https://api.github.com/users/mikemorris/following{/other_user}","gists_url":"https://api.github.com/users/mikemorris/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemorris/subscriptions","organizations_url":"https://api.github.com/users/mikemorris/orgs","repos_url":"https://api.github.com/users/mikemorris/repos","events_url":"https://api.github.com/users/mikemorris/events{/privacy}","received_events_url":"https://api.github.com/users/mikemorris/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":8,"state":"open","created_at":"2015-09-02T18:59:16Z","updated_at":"2015-11-05T00:35:02Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2015-09-15T20:53:28Z","updated_at":"2015-11-09T18:45:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/pulls/2334","html_url":"https://github.com/mapbox/mapbox-gl-native/pull/2334","diff_url":"https://github.com/mapbox/mapbox-gl-native/pull/2334.diff","patch_url":"https://github.com/mapbox/mapbox-gl-native/pull/2334.patch"},"body":"Properly clean up all resources in `NodeMap::release` to allow the `NodeMap`\r\nobject to be garbage collected.\r\n\r\nFixes a memory leak that likely started in https://github.com/mapbox/node-mapbox-gl-native/pull/143 when the `NodeFileSource` object was moved inside the `NodeMap` instead of being an external reference.\r\n\r\n/cc @lucaswoj @jfirebaugh @miccolis"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments/155152042","html_url":"https://github.com/mapbox/mapbox-gl-native/pull/2334#issuecomment-155152042","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/2334","id":155152042,"user":{"login":"tmpsantos","id":996307,"avatar_url":"https://avatars.githubusercontent.com/u/996307?v=3","gravatar_id":"","url":"https://api.github.com/users/tmpsantos","html_url":"https://github.com/tmpsantos","followers_url":"https://api.github.com/users/tmpsantos/followers","following_url":"https://api.github.com/users/tmpsantos/following{/other_user}","gists_url":"https://api.github.com/users/tmpsantos/gists{/gist_id}","starred_url":"https://api.github.com/users/tmpsantos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmpsantos/subscriptions","organizations_url":"https://api.github.com/users/tmpsantos/orgs","repos_url":"https://api.github.com/users/tmpsantos/repos","events_url":"https://api.github.com/users/tmpsantos/events{/privacy}","received_events_url":"https://api.github.com/users/tmpsantos/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T18:45:41Z","updated_at":"2015-11-09T18:45:41Z","body":"> Bringing back observers.erase(observersIt); in NodeFileSource::notify causes a hang FWIW. Think you would be able to lend a hand to help me untangle this @tmpsantos or @kkaefer?\r\n\r\nSeems to me that `NodeRequest` is outliving the `NodeFileSource`. You are canceling the `mbgl::Request` but the `NodeRequest` living in the node Javascript context is still holding a reference to `NodeFileSource` for calling `source->notify()`.\r\n\r\nYou can probably make the `NodeFileSource` subscribe to the requests as an observer, so when you destroy the `NodeFileSource` it would unref the requests and unsubscribe as an observer.\r\n\r\nWhen the request notifies in this case, it would be a no-op."}}