Message290529
| Author |
serhiy.storchaka |
| Recipients |
benjamin.peterson, loewis, rhettinger, serhiy.storchaka |
| Date |
2017年03月26日.13:49:21 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1490536162.09.0.258679205286.issue12414@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I concur with Martin. sys.getsizeof() should only count the memory that is not exposed as separate Python objects. In case of a code object this is the memory of the PyCodeObject structure and the memory of dynamic array co_cellvars (issue15456). Other subobjects are exposed as code object attributes and by gc.get_referents(). For counting the summary size you should recursively call sys.getsizeof() for objects returned by gc.get_referents(). But be aware that some subobjects (for example interned strings) can be shared between different code objects, so the average memory consumption is less than the simple sum. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年03月26日 13:49:22 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, loewis, rhettinger, benjamin.peterson |
| 2017年03月26日 13:49:22 | serhiy.storchaka | set | messageid: <1490536162.09.0.258679205286.issue12414@psf.upfronthosting.co.za> |
| 2017年03月26日 13:49:22 | serhiy.storchaka | link | issue12414 messages |
| 2017年03月26日 13:49:21 | serhiy.storchaka | create |
|