Rewrite Your Ruby VM at Runtime to Hot Patch Useful Features

TLDR

This article shows off a Ruby gem which has the power to overwrite a Ruby binary in memory while it is running to allow your code to execute in place of internal VM functions. This is useful if you’d like to hook all object allocation functions to build a memory profiler.

This gem is on GitHub

Yes, it’s on GitHub: http://github.com/ice799/memprof.

Joe Damato does it again with this awesome post on building a memory profiler for Ruby with hot-patching. Man, that guy is just awesome! :)