{"action":"created","issue":{"url":"https://api.github.com/repos/NativeScript/ios-runtime/issues/1035","repository_url":"https://api.github.com/repos/NativeScript/ios-runtime","labels_url":"https://api.github.com/repos/NativeScript/ios-runtime/issues/1035/labels{/name}","comments_url":"https://api.github.com/repos/NativeScript/ios-runtime/issues/1035/comments","events_url":"https://api.github.com/repos/NativeScript/ios-runtime/issues/1035/events","html_url":"https://github.com/NativeScript/ios-runtime/issues/1035","id":390681026,"node_id":"MDU6SXNzdWUzOTA2ODEwMjY=","number":1035,"title":"Feature Request: Provide automatic garbage collection triggering by the {N} Runtimes","user":{"login":"mbektchiev","id":5744783,"node_id":"MDQ6VXNlcjU3NDQ3ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/5744783?v=4","gravatar_id":"","url":"https://api.github.com/users/mbektchiev","html_url":"https://github.com/mbektchiev","followers_url":"https://api.github.com/users/mbektchiev/followers","following_url":"https://api.github.com/users/mbektchiev/following{/other_user}","gists_url":"https://api.github.com/users/mbektchiev/gists{/gist_id}","starred_url":"https://api.github.com/users/mbektchiev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbektchiev/subscriptions","organizations_url":"https://api.github.com/users/mbektchiev/orgs","repos_url":"https://api.github.com/users/mbektchiev/repos","events_url":"https://api.github.com/users/mbektchiev/events{/privacy}","received_events_url":"https://api.github.com/users/mbektchiev/received_events","type":"User","site_admin":false},"labels":[{"id":189757348,"node_id":"MDU6TGFiZWwxODk3NTczNDg=","url":"https://api.github.com/repos/NativeScript/ios-runtime/labels/feature","name":"feature","color":"0B61A4","default":false}],"state":"open","locked":false,"assignee":{"login":"mbektchiev","id":5744783,"node_id":"MDQ6VXNlcjU3NDQ3ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/5744783?v=4","gravatar_id":"","url":"https://api.github.com/users/mbektchiev","html_url":"https://github.com/mbektchiev","followers_url":"https://api.github.com/users/mbektchiev/followers","following_url":"https://api.github.com/users/mbektchiev/following{/other_user}","gists_url":"https://api.github.com/users/mbektchiev/gists{/gist_id}","starred_url":"https://api.github.com/users/mbektchiev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbektchiev/subscriptions","organizations_url":"https://api.github.com/users/mbektchiev/orgs","repos_url":"https://api.github.com/users/mbektchiev/repos","events_url":"https://api.github.com/users/mbektchiev/events{/privacy}","received_events_url":"https://api.github.com/users/mbektchiev/received_events","type":"User","site_admin":false},"assignees":[{"login":"mbektchiev","id":5744783,"node_id":"MDQ6VXNlcjU3NDQ3ODM=","avatar_url":"https://avatars1.githubusercontent.com/u/5744783?v=4","gravatar_id":"","url":"https://api.github.com/users/mbektchiev","html_url":"https://github.com/mbektchiev","followers_url":"https://api.github.com/users/mbektchiev/followers","following_url":"https://api.github.com/users/mbektchiev/following{/other_user}","gists_url":"https://api.github.com/users/mbektchiev/gists{/gist_id}","starred_url":"https://api.github.com/users/mbektchiev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbektchiev/subscriptions","organizations_url":"https://api.github.com/users/mbektchiev/orgs","repos_url":"https://api.github.com/users/mbektchiev/repos","events_url":"https://api.github.com/users/mbektchiev/events{/privacy}","received_events_url":"https://api.github.com/users/mbektchiev/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/NativeScript/ios-runtime/milestones/37","html_url":"https://github.com/NativeScript/ios-runtime/milestone/37","labels_url":"https://api.github.com/repos/NativeScript/ios-runtime/milestones/37/labels","id":3885968,"node_id":"MDk6TWlsZXN0b25lMzg4NTk2OA==","number":37,"title":"5.2.0","description":"","creator":{"login":"Natalia-Hristova","id":5803037,"node_id":"MDQ6VXNlcjU4MDMwMzc=","avatar_url":"https://avatars0.githubusercontent.com/u/5803037?v=4","gravatar_id":"","url":"https://api.github.com/users/Natalia-Hristova","html_url":"https://github.com/Natalia-Hristova","followers_url":"https://api.github.com/users/Natalia-Hristova/followers","following_url":"https://api.github.com/users/Natalia-Hristova/following{/other_user}","gists_url":"https://api.github.com/users/Natalia-Hristova/gists{/gist_id}","starred_url":"https://api.github.com/users/Natalia-Hristova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Natalia-Hristova/subscriptions","organizations_url":"https://api.github.com/users/Natalia-Hristova/orgs","repos_url":"https://api.github.com/users/Natalia-Hristova/repos","events_url":"https://api.github.com/users/Natalia-Hristova/events{/privacy}","received_events_url":"https://api.github.com/users/Natalia-Hristova/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2018-12-10T11:38:22Z","updated_at":"2018-12-13T13:56:41Z","due_on":"2019-02-13T08:00:00Z","closed_at":null},"comments":7,"created_at":"2018-12-13T13:34:12Z","updated_at":"2018-12-18T07:45:24Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"**Is your feature request related to a problem? Please describe.**\r\nWhen large native objects are created and referenced from JavaScript they do not cause memory pressure for the garbage collection and could remain alive for too long. This sometimes causes memory issues and even app termination.\r\n\r\n**Describe the solution you'd like**\r\nProvide a setting in `app/package.json` for configuring a heuristics algorithm implemented in the {N} runtime, which will periodically check for the current memory footprint of the application and forcefully trigger JS garbage collections depending on memory usage. \r\n\r\nThe idea of the algorithm is to check the current memory footprint on each N (configurable number) of native calls. When the application's memory usage has increased by at least `M`(another configurable value) megabytes it will immediately trigger a garbage collection.\r\n\r\n**Describe alternatives you've considered**\r\nLeave users to manually call `__collect` whenever they decide in the application logic. This however doesn't create a best practice approach and could lead to other problems. Having one recommended approach is preferable although we know that it may have cases which will not benefit or could even suffer (most likely performance-wise) from it. That's why it should be switched off by default. \r\n\r\n**Additional context**\r\nIt turns out that a single garbage collection cycle might not be enough to free a (large) object. This is the case when a long chain of `JS -> Native -> JS -> Native ... ` references leads to the given object. During the first cycle only the first `JS -> Native` part of the chain will be released. The reason is that all `Native` instances keep strong references to JS fields and they cannot be marked for collection until the last `Native` instance referring them is destroyed. On the other hand, all JS instances also hold strong references to the Native fields and they can't be destroyed until the last JS instance holding a reference is garbage collected.\r\n\r\nThe GitHub Issue for the Android Runtime is https://github.com/NativeScript/android-runtime/issues/1232"},"comment":{"url":"https://api.github.com/repos/NativeScript/ios-runtime/issues/comments/448126639","html_url":"https://github.com/NativeScript/ios-runtime/issues/1035#issuecomment-448126639","issue_url":"https://api.github.com/repos/NativeScript/ios-runtime/issues/1035","id":448126639,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODEyNjYzOQ==","user":{"login":"NathanWalker","id":457187,"node_id":"MDQ6VXNlcjQ1NzE4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/457187?v=4","gravatar_id":"","url":"https://api.github.com/users/NathanWalker","html_url":"https://github.com/NathanWalker","followers_url":"https://api.github.com/users/NathanWalker/followers","following_url":"https://api.github.com/users/NathanWalker/following{/other_user}","gists_url":"https://api.github.com/users/NathanWalker/gists{/gist_id}","starred_url":"https://api.github.com/users/NathanWalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NathanWalker/subscriptions","organizations_url":"https://api.github.com/users/NathanWalker/orgs","repos_url":"https://api.github.com/users/NathanWalker/repos","events_url":"https://api.github.com/users/NathanWalker/events{/privacy}","received_events_url":"https://api.github.com/users/NathanWalker/received_events","type":"User","site_admin":false},"created_at":"2018-12-18T07:45:24Z","updated_at":"2018-12-18T07:45:24Z","author_association":"NONE","body":"@mbektchiev it’d be nice if developers had a property to set on certain objects which the system could consider when being more aggressive or not to collect. For example a developer could flag a Page object with ‘gc=“auto”’ or ‘gc=“aggressive” if they knew that page contains a lot of memory hungry components that when navigated away they would want the system to aggressively recollect memory from by calling the GC multiple times or as @pana-cc mentioned potentially traversing the tree to agreesively free up the stack up to the top node with one GC pass or whichever strategy ended up being most effective.\r\n\r\nIdea would be to allow a view property to be set on nodes which the system would consider when doing GC passes and how aggressive it should be with an apps view hierarchy."}}
{"actor":{"display_login":"NathanWalker"}}