Python deep getsizeof list with contents?

后端 未结 5 1873
[愿得一人]
[愿得一人] 2020-12-01 10:44

I was surprised that sys.getsizeof( 10000*[x] ) is 40036 regardless of x: 0, \"a\", 1000*\"a\", {}.
Is there a deep_getsizeof which properly co

5条回答
  •  天命终不由人
    2020-12-01 11:24

    Have a look at guppy/heapy; I haven't played around with it too much myself, but a few of my co-workers have used it for memory profiling with good results.

    The documentation could be better, but this howto does a decent job of explaining the basic concepts.

提交回复
热议问题