COMPAT: avoid getsizeof on PyPy (original) (raw)

Pandas uses sys.getsizeof() to implement memory_usage(). PyPy does not implement this functionality by design, since memory size is not fixed, depending on the JIT and other optimizations the memory usage of an object can change.

I would like to suggest one possible solution: using the default in sys.getsizeof(obj, default). If this is unacceptable, I could suggest that using deep=True would raise a TypeErrpr instead, but that would be more complicated. Any opinions? (proof-of-concept pull request forthcoming)