This is a prototype and work in progress. It's not recommended for general usage until more testing has been done.
This project provides a simple, alternative, and performant way to track object allocations without impacting performance as much object space tracing does from within Ruby. It's useful for gathering metrics in production environments for debugging memory bloat and leak issues.
This stemmed from needing better allocation data within New Relic, and takes a similar approach to how both Scout and AppSignal gather data for their APM systems:
A few other Ruby libraries like Stackprof also utilize the approach to generate metrics:
Install the gem and add to the application's Gemfile by executing:
$ bundle add object_allocation_tracker
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install object_allocation_tracker
allocations = ObjectAllocationTracker.start do
100.times { |_| Object.new }
end
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
Bug reports and pull requests are welcome on GitHub at https://github.com/eventtemple/object_allocation_tracker.