{"action":"created","issue":{"url":"https://api.github.com/repos/rebar/rebar3/issues/585","labels_url":"https://api.github.com/repos/rebar/rebar3/issues/585/labels{/name}","comments_url":"https://api.github.com/repos/rebar/rebar3/issues/585/comments","events_url":"https://api.github.com/repos/rebar/rebar3/issues/585/events","html_url":"https://github.com/rebar/rebar3/issues/585","id":92593733,"number":585,"title":"Memory consumption (in general and especially when running shell)","user":{"login":"binarin","id":185443,"avatar_url":"https://avatars.githubusercontent.com/u/185443?v=3","gravatar_id":"","url":"https://api.github.com/users/binarin","html_url":"https://github.com/binarin","followers_url":"https://api.github.com/users/binarin/followers","following_url":"https://api.github.com/users/binarin/following{/other_user}","gists_url":"https://api.github.com/users/binarin/gists{/gist_id}","starred_url":"https://api.github.com/users/binarin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binarin/subscriptions","organizations_url":"https://api.github.com/users/binarin/orgs","repos_url":"https://api.github.com/users/binarin/repos","events_url":"https://api.github.com/users/binarin/events{/privacy}","received_events_url":"https://api.github.com/users/binarin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-02T09:32:04Z","updated_at":"2015-07-02T09:51:11Z","closed_at":null,"body":"Hi.\r\n\r\nI have 12 apps in my project and 'rebar3 shell' consumes a 1.5GB of memory for its ''rebar_agent\" process (and I can't start shell with 14 apps on my machine with 8G of RAM).\r\n\r\nTop-level rebar state (in rebar_prv_shell) looks like a gigantic tree of at least 12 levels deep (each of rebar_state:project_apps containing in its rebar_app_info:state link to some other rebar state with some incomplete list of project apps and so on). Doing size(term_to_binary(State)) at this point returns around 32 megabytes, which looks reasonable, but interesting things start to happen after this state is passed to rebar_agent:start_link() (and then to gen_server:start_link()), where it's somehow inflated to a whopping 1.5G of ram.\r\n\r\nI don't know what the right solution is, maybe the rebar state should be pruned from this nested 'project_apps -> state -> ...' things before passing to rebar_agent:start_link().\r\n\r\nAnd probably ability to disable rebar_agent in the shell can be usefull. So if you use some other code reloader, it will not interfere with it. E.g. you could want to use sync because it can reload code on all connected nodes."},"comment":{"url":"https://api.github.com/repos/rebar/rebar3/issues/comments/117985177","html_url":"https://github.com/rebar/rebar3/issues/585#issuecomment-117985177","issue_url":"https://api.github.com/repos/rebar/rebar3/issues/585","id":117985177,"user":{"login":"kovyl2404","id":3457910,"avatar_url":"https://avatars.githubusercontent.com/u/3457910?v=3","gravatar_id":"","url":"https://api.github.com/users/kovyl2404","html_url":"https://github.com/kovyl2404","followers_url":"https://api.github.com/users/kovyl2404/followers","following_url":"https://api.github.com/users/kovyl2404/following{/other_user}","gists_url":"https://api.github.com/users/kovyl2404/gists{/gist_id}","starred_url":"https://api.github.com/users/kovyl2404/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kovyl2404/subscriptions","organizations_url":"https://api.github.com/users/kovyl2404/orgs","repos_url":"https://api.github.com/users/kovyl2404/repos","events_url":"https://api.github.com/users/kovyl2404/events{/privacy}","received_events_url":"https://api.github.com/users/kovyl2404/received_events","type":"User","site_admin":false},"created_at":"2015-07-02T09:51:11Z","updated_at":"2015-07-02T09:51:11Z","body":"+1. It's hard to believe, but when building quite large project, I've seen rebar3 node crashed with \"out of memory\" several times."}}