dumpster

Version, currently master branch1 version
  • master branchlatestOct 24, 2024

github.com/place-labs/dumpster

Fast memory dump analysis for Ruby

3 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  dumpster:
    github: place-labs/dumpster
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
no constraint declared
License
MIT
Author
Kim Burgess
Target
  • dumpster from src/dumpster.cr

Dependencies

Runtime Dependencies

  • future*github: crystal-community/future.cr
  • linalg*github: konovod/linalg
  • numcry*github: aca-labs/numcry, branch: master
  • terminimal*github: aca-labs/terminimal
  • json_mapping*github: crystal-lang/json_mapping.cr

README

Dumpster

An analysis tool for Ruby MRI heap dumps.

Provides automated analysis and identification of potential memory leaks within a program.

Usage

Capturing Heap Dumps

Using rbtrace, enable allocation tracking on the ruby process you'd like to inspect. Note: this will result in a perf impact while active. Use with care.

rbtrace -p <pid> -e 'Thread.new{require "objspace";ObjectSpace.trace_object_allocations_start}.join'

After the process has had time to rotate through a few GC generations, export via:

rbtrace -p <pid> -e 'Thread.new{require "objspace";io=File.open("/tmp/ruby-heap.dump", "w");ObjectSpace.dump_all(output: io);io.close}.join'

To stop tracking and clear allocations from mem:

rbtrace -p <pid> -e 'Thread.new{GC.start;require "objspace";ObjectSpace.trace_object_allocations_stop;ObjectSpace.trace_object_allocations_clear}.join'

Analysis

!! When using outside of a dev context, analysis should always take place on a machine remote to that running the application under analysis.

./dumpster ruby-heap.dump

Depending on the size of heap dump being parsed, analysis may take some time. Progress will be provided. When complete, a ordered list of 'locations of interest' will be provided. These are lines responsible for an increasing number of long-lived object allocations that may be indicative of a memory leak.

Contributing

  1. Fork it ( https://github.com/[your-github-name]/dumpster/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors