First release of Alys, a memory allocation tracer for Crystal

Alys is a project I’ve been working on-and-off for a few months now, originating from some discussion on the Lucky Discord on finding the source of a memory “leak”. It’s in EARLY ALPHA STATE, but it’s quite easy to plug into an application and generate tracing events, which can then be converted into a custom JSON format or Go’s pprof format (which can be viewed in an interactive web UI via the pprof tool).

Note that it has only been tested on Linux thus far!

As a quick preview, this is what it looks like loading the pprof web UI for tracing data generated from Lucky’s website application:

I would appreciate any feedback and thoughts on real-world usage!

EDIT: Also worth noting this is NOT multithreading-safe! I plan on moving some logic to a separate thread, which will probably improve perf but also make room for preview_mt support.


How does it work?

Right now it just overrides the GC allocation/deallocation functions to also take a backtrace and write info to a file, not too exciting.