4 ms·
sys.getsizeof() on a code object returns the size of the code struct, not all the other objects it references. To measure real usage, you have to use another m
by lqdc13 10y ago
sys.getsizeof() on a code object returns the size of the code struct, not all the other objects it references.
To measure real usage, you have to use another method. I use ipython_memory_usage because it's easy to use.
You can test this out easily by making a large dict and see how much your OS thinks python is using vs what sys.getsizeof is reporting.