Message198107
Here is why using get_referents() is stupid in the general case:
>>> class C: pass
...
>>> c = C()
>>> gc.get_referents(c)
[<class '__main__.C'>]
With your method, measuring c's memory consumption also includes the memory consumption of its type object.
(and of course this is only a trivial example... one can only imagine what kind of mess it is with a non-trivial object) |
|
Date |
User |
Action |
Args |
2013-09-19 18:17:46 | pitrou | set | recipients:
+ pitrou, loewis, rhettinger, amaury.forgeotdarc, serhiy.storchaka |
2013-09-19 18:17:46 | pitrou | set | messageid: <1379614666.43.0.926228207973.issue19048@psf.upfronthosting.co.za> |
2013-09-19 18:17:46 | pitrou | link | issue19048 messages |
2013-09-19 18:17:46 | pitrou | create | |
|