Author xiang.zhang
Recipients berker.peksag, methane, minrk, vstinner, xiang.zhang
Date 2016-09-14.19:27:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473881270.5.0.20265657242.issue28147@psf.upfronthosting.co.za>
In-reply-to
Content
> I confirmed and investigated it.  Thanks!
I'll post patch including more test in 24 hours.

Please wait a second.

The cause of this problem is that attribute setting causes a combined table to be splitted (the code path is [0]->[1]->[2]->[3]). So every time you set an attribute and then pop, it will do dictresize(right now it will increase memory usage). So even if you make pop() not increase memory usage, the example Min gives will still do much work not wanted (dictresize and make_keys_shared).

Actually I think memory usage increasing is not a problem if other things are right. popitem() before does the same thing and should never cause a problem.
 
[0] https://hg.python.org/cpython/file/tip/Python/ceval.c#l2248
[1] https://hg.python.org/cpython/file/tip/Objects/object.c#l1119
[2] https://hg.python.org/cpython/file/tip/Objects/object.c#l1125
[3] https://hg.python.org/cpython/file/tip/Objects/object.c#l1172
History
Date User Action Args
2016-09-14 19:27:50xiang.zhangsetrecipients: + xiang.zhang, vstinner, methane, berker.peksag, minrk
2016-09-14 19:27:50xiang.zhangsetmessageid: <1473881270.5.0.20265657242.issue28147@psf.upfronthosting.co.za>
2016-09-14 19:27:50xiang.zhanglinkissue28147 messages
2016-09-14 19:27:50xiang.zhangcreate