pythonspeed / filprofiler

A Python memory profiler for data processing and scientific computing applications
https://pythonspeed.com/products/filmemoryprofiler/
Apache License 2.0
824 stars 24 forks source link

PyPy Support #25

Open thedrow opened 4 years ago

thedrow commented 4 years ago

Is PyPy support planned? Is it currently not feasible? If so, how can we help make it feasible?

itamarst commented 4 years ago

I haven't really thought about PyPy. Theoretically it should be possible.

The way Fil works is that there is a fairly generic Rust library that does all the data structure work: keeping track of allocations and dumping them to SVG.

Then, there's _filpreload.c that:

  1. Overrides malloc and friends and forwards it to the Rust code. This bit would apply to PyPy too, or really to other programming languages.
  2. Efficiently figures out what the current callstack is when an allocation/free happens. This bit is highly CPython-specific, and is what allows Fil to be not too slow.

So that last bit is what would need to be rewritten in a PyPy-specific way.

itamarst commented 4 years ago

That second part of _filpreload.c is currently being rewritten (#18). Once that is done, a good next step would be to split _filpreload.c into two, so there's a clear boundary between generic code and CPython-specific code.