What Fil tracks

Fil will track memory allocated by:

  • Normal Python code.
  • C code using malloc()/calloc()/realloc()/posix_memalign().
  • C++ code using new (including via aligned_alloc()).
  • Anonymous mmap()s.
  • Fortran 90 explicitly allocated memory (tested with gcc’s gfortran; let me know if other compilers don’t work).

Still not supported, but planned:

  • mremap() (resizing of mmap()).

Maybe someday:

  • File-backed mmap(). The semantics are somewhat different than normal allocations or anonymous mmap(), since the OS can swap it in or out from disk transparently, so supporting this will involve a different kind of resource usage and reporting.
  • Other forms of shared memory, need to investigate if any of them allow sufficient allocation.
  • Anonymous mmap()s created via /dev/zero (not common, since it’s not cross-platform, e.g. macOS doesn’t support this).
  • memfd_create(), a Linux-only mechanism for creating in-memory files.
  • memalign, valloc(), pvalloc(), reallocarray(). These are all rarely used, as far as I can tell.