{"action":"created","issue":{"url":"https://api.github.com/repos/peterbraden/node-opencv/issues/270","labels_url":"https://api.github.com/repos/peterbraden/node-opencv/issues/270/labels{/name}","comments_url":"https://api.github.com/repos/peterbraden/node-opencv/issues/270/comments","events_url":"https://api.github.com/repos/peterbraden/node-opencv/issues/270/events","html_url":"https://github.com/peterbraden/node-opencv/pull/270","id":96839176,"number":270,"title":"Explicit Memory Management","user":{"login":"Queuecumber","id":5865387,"avatar_url":"https://avatars.githubusercontent.com/u/5865387?v=3","gravatar_id":"","url":"https://api.github.com/users/Queuecumber","html_url":"https://github.com/Queuecumber","followers_url":"https://api.github.com/users/Queuecumber/followers","following_url":"https://api.github.com/users/Queuecumber/following{/other_user}","gists_url":"https://api.github.com/users/Queuecumber/gists{/gist_id}","starred_url":"https://api.github.com/users/Queuecumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Queuecumber/subscriptions","organizations_url":"https://api.github.com/users/Queuecumber/orgs","repos_url":"https://api.github.com/users/Queuecumber/repos","events_url":"https://api.github.com/users/Queuecumber/events{/privacy}","received_events_url":"https://api.github.com/users/Queuecumber/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-23T15:24:01Z","updated_at":"2015-07-23T16:24:53Z","closed_at":"2015-07-23T15:37:21Z","pull_request":{"url":"https://api.github.com/repos/peterbraden/node-opencv/pulls/270","html_url":"https://github.com/peterbraden/node-opencv/pull/270","diff_url":"https://github.com/peterbraden/node-opencv/pull/270.diff","patch_url":"https://github.com/peterbraden/node-opencv/pull/270.patch"},"body":"As per #209 and my own experiments, it seems like nodejs is kind of terrible when it comes to managing the lifetime of these images for whatever reason (especially if you use promises). Luckily opencv provides us with a release function that we can use to force memory to be freed, so I exposed it to the Javascript side. Preliminary testing shows that this saves a huge amount of memory over a large number of operations, and I highly recommend that people use it for production code.\r\n\r\nI'll give you some time to review this if you want to pull it in yourself, otherwise I'll do it myself next week. "},"comment":{"url":"https://api.github.com/repos/peterbraden/node-opencv/issues/comments/124158180","html_url":"https://github.com/peterbraden/node-opencv/pull/270#issuecomment-124158180","issue_url":"https://api.github.com/repos/peterbraden/node-opencv/issues/270","id":124158180,"user":{"login":"Queuecumber","id":5865387,"avatar_url":"https://avatars.githubusercontent.com/u/5865387?v=3","gravatar_id":"","url":"https://api.github.com/users/Queuecumber","html_url":"https://github.com/Queuecumber","followers_url":"https://api.github.com/users/Queuecumber/followers","following_url":"https://api.github.com/users/Queuecumber/following{/other_user}","gists_url":"https://api.github.com/users/Queuecumber/gists{/gist_id}","starred_url":"https://api.github.com/users/Queuecumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Queuecumber/subscriptions","organizations_url":"https://api.github.com/users/Queuecumber/orgs","repos_url":"https://api.github.com/users/Queuecumber/repos","events_url":"https://api.github.com/users/Queuecumber/events{/privacy}","received_events_url":"https://api.github.com/users/Queuecumber/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T16:24:53Z","updated_at":"2015-07-23T16:24:53Z","body":"@salmanulhaq I found that unless I use Promises, the GC does a decent job. As soon as I switch to Promises, things start being kept around way longer than they should. \r\n\r\nAs far as dealing with Buffer object, this might help you (https://www.npmjs.com/package/buffer-dispose)"}}