is there any alternative to sys.getsizeof() in PyPy?
问题 I am trying to run a Python (2.7) script with PyPy but I have encountered the following error: TypeError: sys.getsizeof() is not implemented on PyPy. A memory profiler using this function is most likely to give results inconsistent with reality on PyPy. It would be possible to have sys.getsizeof() return a number (with enough work), but that may or may not represent how much memory the object uses. It doesn't even make really sense to ask how much *one* object uses, in isolation with the rest