{"action":"created","issue":{"url":"https://api.github.com/repos/swig/swig/issues/343","labels_url":"https://api.github.com/repos/swig/swig/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/swig/swig/issues/343/comments","events_url":"https://api.github.com/repos/swig/swig/issues/343/events","html_url":"https://github.com/swig/swig/pull/343","id":57933282,"number":343,"title":"Added SWIG #define to call v8 garbage collector","user":{"login":"Zion-ICS","id":9810219,"avatar_url":"https://avatars.githubusercontent.com/u/9810219?v=3","gravatar_id":"","url":"https://api.github.com/users/Zion-ICS","html_url":"https://github.com/Zion-ICS","followers_url":"https://api.github.com/users/Zion-ICS/followers","following_url":"https://api.github.com/users/Zion-ICS/following{/other_user}","gists_url":"https://api.github.com/users/Zion-ICS/gists{/gist_id}","starred_url":"https://api.github.com/users/Zion-ICS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zion-ICS/subscriptions","organizations_url":"https://api.github.com/users/Zion-ICS/orgs","repos_url":"https://api.github.com/users/Zion-ICS/repos","events_url":"https://api.github.com/users/Zion-ICS/events{/privacy}","received_events_url":"https://api.github.com/users/Zion-ICS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-17T14:53:43Z","updated_at":"2015-02-18T22:19:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/swig/swig/pulls/343","html_url":"https://github.com/swig/swig/pull/343","diff_url":"https://github.com/swig/swig/pull/343.diff","patch_url":"https://github.com/swig/swig/pull/343.patch"},"body":"The destructors in our nodeJS-wrapped C++ classes weren’t being invoked— even on termination.\r\nv8 doesn’t guarantee gc— even on scope closing or program termination.\r\nWe need to call gc manually.\r\nAdding a #define lets us call 1 SWIG function that will be maintained— instead of having many #ifdefs."},"comment":{"url":"https://api.github.com/repos/swig/swig/issues/comments/74960732","html_url":"https://github.com/swig/swig/pull/343#issuecomment-74960732","issue_url":"https://api.github.com/repos/swig/swig/issues/343","id":74960732,"user":{"login":"Zion-ICS","id":9810219,"avatar_url":"https://avatars.githubusercontent.com/u/9810219?v=3","gravatar_id":"","url":"https://api.github.com/users/Zion-ICS","html_url":"https://github.com/Zion-ICS","followers_url":"https://api.github.com/users/Zion-ICS/followers","following_url":"https://api.github.com/users/Zion-ICS/following{/other_user}","gists_url":"https://api.github.com/users/Zion-ICS/gists{/gist_id}","starred_url":"https://api.github.com/users/Zion-ICS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zion-ICS/subscriptions","organizations_url":"https://api.github.com/users/Zion-ICS/orgs","repos_url":"https://api.github.com/users/Zion-ICS/repos","events_url":"https://api.github.com/users/Zion-ICS/events{/privacy}","received_events_url":"https://api.github.com/users/Zion-ICS/received_events","type":"User","site_admin":false},"created_at":"2015-02-18T22:19:08Z","updated_at":"2015-02-18T22:19:08Z","body":"I have a question!\r\nI figured out how to automatically include a v8 garbage collection function in every SWIG-generated nodeJS library.\r\n\r\nIt involves adding a new SWIG feature: allowing per-language auto-included code into .i files.\r\n\r\nIf a language has a file called \"interface_lang_defaults.i\" in its library folder, the code will be processed as if a user added it at the end of his/her .i file.\r\n\r\nFor example: I put a v8 gc function in interface_lang_defaults.i and then moved it to Lib/javascript/v8/. Now everybody wrapping C++ classes with nodeJS can call v8 garbage collection. Note that this should also let you destroy C++ primitives such as int16 or uint16 that you send to JS using %array_class.\r\nI'll also include a parallel no-op version for jsc so running cleanUp won't cause any exceptions to be thrown.\r\n\r\nIs \"per-language auto-included code\" a desired feature?\r\nIf so, I'll...\r\n1) Modify the JavaScript examples to use this code \r\n2) Document garbage collection and v8\r\n3) Document \"per-language auto-included code\"\r\n4) PR the new code and documentation\r\n\r\nThank you very much!!!!"}}