Message166865
> For the PyAccu, AFAICT, objects cannot leak out of it (except for gc.getobjects in debug mode).
Not only in debug mode.
>>> import io, gc
>>> s=io.StringIO()
>>> s.write('12345')
5
>>> s.write('qwerty')
6
>>> for o in gc.get_objects():
... if "'123" in repr(o) and len(repr(o)) < 1000:
... print(type(o), repr(o))
...
<class 'list'> ['12345', 'qwerty']
<class 'list'> ['o', 'gc', 'get_objects', 'repr', 'o', "'123", 1000, 'len', 'repr', 'o', 'print', 'type', 'o', 'repr', 'o']
<class 'tuple'> ("'123", 1000, None)
Someone can summarize sys.getsizeof() for all managed by GC objects and therefore count internal objects twice.
I think the standard library should provide a method for recursive calculation of memory (in some sense, perhaps using different strategies), but that should wait up to 3.4. __sizeof__ should count non-object memory that is not available for GC. As I understand it. |
|
Date |
User |
Action |
Args |
2012-07-30 08:14:11 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, loewis, pitrou, benjamin.peterson, stutzbach, hynek |
2012-07-30 08:14:11 | serhiy.storchaka | set | messageid: <1343636051.68.0.24385243692.issue15490@psf.upfronthosting.co.za> |
2012-07-30 08:14:11 | serhiy.storchaka | link | issue15490 messages |
2012-07-30 08:14:10 | serhiy.storchaka | create | |
|