msg129574 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2011-02-26 17:02 |
In list.sort, if a key function throws an exception, the memory to store the keys is never freed. I introduced the bug in r86937. I'll upload a patch for review shortly. |
|
|
msg129575 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2011-02-26 17:12 |
Below is a link to the code where leak occurs and the patch goes: http://svn.python.org/view/python/branches/py3k/Objects/listobject.c?view=markup&pathrev=88554#l1944 |
|
|
msg129579 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2011-02-26 17:33 |
LGTM |
|
|
msg129925 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2011-03-02 23:46 |
Is there a way to test this? |
|
|
msg129926 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2011-03-02 23:49 |
Valgrind perhaps? If the "keys" container was a list or tuple it would simply take a refleak run of the test suite. |
|
|
msg129927 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2011-03-02 23:53 |
I'm not sure. What infrastructure do we have to leaked memory that was allocated with PyMem_MALLOC? |
|
|
msg129928 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2011-03-02 23:53 |
I meant "to *detect* leaked memory", of course. :-) |
|
|
msg129929 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2011-03-03 00:06 |
I played around with this a little. That code path doesn't appear to be exercised during the existing unit tests. I'll add a test so the leak at least shows up when the tests are run under valgrind. |
|
|
msg134994 - (view) |
Author: Daniel Stutzbach (stutzbach)  |
Date: 2011-05-02 17:29 |
I checked in a fix to 3.3 just before the transition to hg. I confess that I've been procrastinating on getting hg set up properly, which is why I haven't gotten to checking this in to 3.2. Georg, if I get this in by Wednesday, will that be soon enough for your schedule for 3.2.1? (it sounds like it will be) |
|
|
msg135000 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2011-05-02 19:12 |
Sure, Wednesday will be fine. |
|
|
msg135155 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2011-05-04 20:06 |
New changeset 52fb7dc721ed by Daniel Stutzbach in branch '3.2': #11335: Fix memory leak after key function failure in sort http://hg.python.org/cpython/rev/52fb7dc721ed New changeset 18e43c6acfff by Daniel Stutzbach in branch 'default': #11335: Merge from 3.2: Fix memory leak after key function failure in sort http://hg.python.org/cpython/rev/18e43c6acfff |
|
|