a simple memory leak detector for ruby with preconfigured rails
gem install dike
the concept behind dike.rb is simple: class Object is extended in
the location of each object's creation is tracked. a summarizer
given to walk ObjectSpace using each object's class and the location
creation to detect memory leaks. not all leaks can be detected and
are may not really be leaks, but dike provided a simple way to see
hotspots in your code that may potentially be leaking.
- under rare circumstances dike itself interacted strangely with
classes and caused them to leak, HTTPOK was one such example.
release fixes that bug. thanks to Jan Kubr for providing a
case that helped me fix this.
### PURE RUBY
## just dumping sequential snapshots to stderr, looking at a
# cfp:~ > cat sample/a.rb
class Leak < ::String
Leaks = Array.new
Leaks << Leak.new('leak' * 1024)
# cfp:~ > ruby sample/a.rb | less