{"action":"created","issue":{"url":"https://api.github.com/repos/Samsung/jerryscript/issues/1392","repository_url":"https://api.github.com/repos/Samsung/jerryscript","labels_url":"https://api.github.com/repos/Samsung/jerryscript/issues/1392/labels{/name}","comments_url":"https://api.github.com/repos/Samsung/jerryscript/issues/1392/comments","events_url":"https://api.github.com/repos/Samsung/jerryscript/issues/1392/events","html_url":"https://github.com/Samsung/jerryscript/issues/1392","id":183168547,"number":1392,"title":"[Question] Is there a way to free all memory allocated in JerryScript?","user":{"login":"brianjjones","id":725841,"avatar_url":"https://avatars.githubusercontent.com/u/725841?v=3","gravatar_id":"","url":"https://api.github.com/users/brianjjones","html_url":"https://github.com/brianjjones","followers_url":"https://api.github.com/users/brianjjones/followers","following_url":"https://api.github.com/users/brianjjones/following{/other_user}","gists_url":"https://api.github.com/users/brianjjones/gists{/gist_id}","starred_url":"https://api.github.com/users/brianjjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianjjones/subscriptions","organizations_url":"https://api.github.com/users/brianjjones/orgs","repos_url":"https://api.github.com/users/brianjjones/repos","events_url":"https://api.github.com/users/brianjjones/events{/privacy}","received_events_url":"https://api.github.com/users/brianjjones/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Samsung/jerryscript/labels/question","name":"question","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-10-14T23:03:07Z","updated_at":"2016-10-26T21:55:20Z","closed_at":"2016-10-26T21:55:20Z","body":"I have a JavaScript file loaded in JerryScript that runs forever using setInterval. On occasion I need to restart this JavaScript. This code contains objects that are using jerry_set_object_native_handle, and I need to free this memory. I passed jerry_set_object_native_handle a callback to execute for releasing the handle when the JavaScript stops. If I declare the JavaScript object locally and let it go out of scope, the close callback gets called as expected. But I find this doesn't work on objects declared in the global scope, their memory just gets leaked when I restart the JavaScript.  This means that after restarting my JavaScript a couple of times I run out of memory and the system locks up. I tried calling both jerry_clear() and jerry_gc() to free any allocated memory but this still did not result in the close callback being called, and the memory remained.\r\n\r\nIs there a way to force JerryScript to garbage collect all memory regardless of whether it is still referenced?  Basically I need my JerryScript instance to go back to square one with a completely clean slate.\r\n\r\nThanks.\r\n"},"comment":{"url":"https://api.github.com/repos/Samsung/jerryscript/issues/comments/256488917","html_url":"https://github.com/Samsung/jerryscript/issues/1392#issuecomment-256488917","issue_url":"https://api.github.com/repos/Samsung/jerryscript/issues/1392","id":256488917,"user":{"login":"brianjjones","id":725841,"avatar_url":"https://avatars.githubusercontent.com/u/725841?v=3","gravatar_id":"","url":"https://api.github.com/users/brianjjones","html_url":"https://github.com/brianjjones","followers_url":"https://api.github.com/users/brianjjones/followers","following_url":"https://api.github.com/users/brianjjones/following{/other_user}","gists_url":"https://api.github.com/users/brianjjones/gists{/gist_id}","starred_url":"https://api.github.com/users/brianjjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianjjones/subscriptions","organizations_url":"https://api.github.com/users/brianjjones/orgs","repos_url":"https://api.github.com/users/brianjjones/repos","events_url":"https://api.github.com/users/brianjjones/events{/privacy}","received_events_url":"https://api.github.com/users/brianjjones/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T21:55:19Z","updated_at":"2016-10-26T21:55:19Z","body":"AH! Calling jerry_release_value on the global_object seems to fix my problem. Now I'm seeing the callback get called for the global objects when cleanup runs.  Thanks for all the help @LaszloLango  and @zherczeg"}}
{"actor":{"display_login":"brianjjones"}}