{"action":"created","issue":{"url":"https://api.github.com/repos/skylightio/skylight-ruby/issues/36","labels_url":"https://api.github.com/repos/skylightio/skylight-ruby/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/skylightio/skylight-ruby/issues/36/comments","events_url":"https://api.github.com/repos/skylightio/skylight-ruby/issues/36/events","html_url":"https://github.com/skylightio/skylight-ruby/issues/36","id":92064477,"number":36,"title":"Gem object allocation","user":{"login":"sergey-alekseev","id":2371639,"avatar_url":"https://avatars.githubusercontent.com/u/2371639?v=3","gravatar_id":"","url":"https://api.github.com/users/sergey-alekseev","html_url":"https://github.com/sergey-alekseev","followers_url":"https://api.github.com/users/sergey-alekseev/followers","following_url":"https://api.github.com/users/sergey-alekseev/following{/other_user}","gists_url":"https://api.github.com/users/sergey-alekseev/gists{/gist_id}","starred_url":"https://api.github.com/users/sergey-alekseev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergey-alekseev/subscriptions","organizations_url":"https://api.github.com/users/sergey-alekseev/orgs","repos_url":"https://api.github.com/users/sergey-alekseev/repos","events_url":"https://api.github.com/users/sergey-alekseev/events{/privacy}","received_events_url":"https://api.github.com/users/sergey-alekseev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-06-30T11:21:39Z","updated_at":"2015-08-26T22:24:14Z","closed_at":null,"body":"According to http://blog.skylight.io/announcing-memory-traces/:\r\n>Allocating many objects can cause expensive garbage collection sweeps to become more frequent, slowing down the performance of your entire app. \r\n\r\nHowever I found that `skylight` gem itself allocates a lot of objects. 75 times more than `newrelic_rpm`.\r\n\r\n```\r\n$ derailed bundle:objects\r\n\r\nallocated memory by gem\r\n-----------------------------------\r\n  55716710  activesupport-4.1.11\r\n  36911424  skylight-0.6.0\r\n   9965675  mime-types-2.6.1\r\n  ...\r\n```\r\n\r\nAre you going to reduce the amount of allocated objects or it's considered not a problem?"},"comment":{"url":"https://api.github.com/repos/skylightio/skylight-ruby/issues/comments/135195240","html_url":"https://github.com/skylightio/skylight-ruby/issues/36#issuecomment-135195240","issue_url":"https://api.github.com/repos/skylightio/skylight-ruby/issues/36","id":135195240,"user":{"login":"wagenet","id":9835,"avatar_url":"https://avatars.githubusercontent.com/u/9835?v=3","gravatar_id":"","url":"https://api.github.com/users/wagenet","html_url":"https://github.com/wagenet","followers_url":"https://api.github.com/users/wagenet/followers","following_url":"https://api.github.com/users/wagenet/following{/other_user}","gists_url":"https://api.github.com/users/wagenet/gists{/gist_id}","starred_url":"https://api.github.com/users/wagenet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wagenet/subscriptions","organizations_url":"https://api.github.com/users/wagenet/orgs","repos_url":"https://api.github.com/users/wagenet/repos","events_url":"https://api.github.com/users/wagenet/events{/privacy}","received_events_url":"https://api.github.com/users/wagenet/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T22:24:13Z","updated_at":"2015-08-26T22:24:13Z","body":"So the actual code generating this information is `ObjectSpace` via the `memory_profiler` gem. When I run `derailed bundle:objects` against our Rails app, I get the following:\r\n\r\n```\r\nallocated memory by gem\r\n-----------------------------------\r\n  41178014  skylight\r\n```\r\n\r\n```\r\nallocated memory by location\r\n-----------------------------------\r\n  41120969  .../skylight/lib/skylight/probes.rb:81\r\n```\r\n\r\nWhere line 81 is: https://github.com/skylightio/skylight-ruby/blob/v0.8.0/lib/skylight/probes.rb#L81.\r\n\r\nSo basically the issue is just that technically, a bunch of the `requires` are taking place in Skylight itself, even though they were requested from elsewhere. Skylight isn't allocating this memory itself. Running `derailed bundle:mem` is much more accurate."}}