All projects

Illimani & FiLiP

A framework for building custom memory profilers, and an object lifetime profiler built on top of it.

Pharo, Memory profiling, Garbage collection

The problem

To understand why a program uses too much memory, or why the garbage collector is slow, you need to know which objects are allocated, where in the code, and how long they live. General-purpose profilers rarely answer all three, and in Pharo every allocation goes through a handful of shared primitive methods, which hides where objects really come from.

What I built

Illimani instruments all 14 allocator methods of Pharo (with MethodProxies) and captures every object allocation. To build your own memory profiler you subclass one class and override a few methods. It ships with an allocation-rate profiler and an allocation call-graph profiler.

FiLiP (Finalization Lifetime Profiler) estimates how long each object lives. It records the birth of an object at allocation and its death through finalization, a virtual machine mechanism, so it needs no change to the VM. It has a full GUI and a queryable statistics model, and it samples allocations to keep the cost down.

Results

FiLiP stays accurate even at a 1% sampling rate, and at 0.1% it slows programs down by only 1.26× on average, which makes it practical on real applications. Its evaluation was published at ISMM 2024, the International Symposium on Memory Management. Illimani and FiLiP have been used to find and fix memory problems in production Pharo code, such as the DataFrame library.