memory: Use gc.get_referents to walk objects.

This is simpler and more accurage.
memory: Try to speed up profiling.