Ruby Memory Tracking API

By Stephen Kellett
1 December, 2006

To provide the memory tracking, heap dump and object referencing facilities in Ruby Memory Validator we had to reverse engineer some hooks into the Ruby executable. This is not the easiest task in the world and beyond the abilities of anyone with less than a cursory knowledge of x86 assembly and Win32 hooking techniques.

To make it easier for this work to be done, to make it more reliable and to make these hooks available for those that just want to mainly work with Ruby and write a little C (as opposed to getting immersed in PE formats, x86 assembly and so on) we have created an extension to Ruby that provides for memory allocation and deallocation tracking, heap dumping and object reference determination. The extension is in the form of a simple C API.

The article describing this work no longer exists. Sorry. However you can still download the Ruby memtrack API source files and the DLLs that were built to use the API. You can modify these and build your own to work with current versions of Ruby.

If you have any comments, please contact support at the usual address.

Fully functional, free for 30 days