I am working on a python memory profiler , where I compile the size of python objects in the following way:
sum(map(sys.getsizeof, gc.get_objects()))
This is the slowest part of the code, especially gc.get_objects , so I decided to speed it up and rewrite it as a c extension. The problem is that the python c API does not provide access to the internal data of the gc module, which is used by gc.get_objects .
Is it possible to gc.get_objects over all objects using the c API without calling the expensive gc.get_objects ?
source share