Title: test_ast leaks memory a lot
Type: resource usage Stage: resolved
Components: Interpreter Core Versions: Python 3.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, georg.brandl, neologix, pitrou, python-dev, skrah
Priority: critical Keywords:

Created on 2012-07-08 10:18 by pitrou, last changed 2012-07-08 10:45 by pitrou. This issue is now closed.

Messages (5)
msg164992 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-08 10:18
On the default branch, if you run test_ast in a loop:

./python -E -m test -F test_ast

you will see that the process memory use grows very quickly. This doesn't happen on 3.2.
I'm not a Valgrind expert so perhaps someone else can take a look. Otherwise I'll try to bisect.
msg164994 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-08 10:26
So, the culprit is:

changeset:   75542:3877bf2e3235
user:        Benjamin Peterson <>
date:        Mon Mar 12 09:46:44 2012 -0700
summary:     give the AST class a __dict__
msg164997 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-08 10:36
Strangely, the reference leak was fixed in:

changeset:   75686:9e7f6ddc0d76
user:        Benjamin Peterson <>
date:        Wed Mar 14 21:50:29 2012 -0500
summary:     free AST's dict

But it didn't fix the memory leak.
msg164999 - (view) Author: Roundup Robot (python-dev) Date: 2012-07-08 10:45
New changeset 048d8d9aecf1 by Antoine Pitrou in branch 'default':
Issue #15291: Fix a memory leak where AST nodes where not properly deallocated.
msg165000 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-07-08 10:45
Well, that was easy :)
Date User Action Args
2012-07-08 10:45:48pitrousetstatus: open -> closed
resolution: fixed
messages: + msg165000

stage: resolved
2012-07-08 10:45:24python-devsetnosy: + python-dev
messages: + msg164999
2012-07-08 10:36:05pitrousetmessages: + msg164997
2012-07-08 10:26:43pitrousetnosy: + georg.brandl, benjamin.peterson
messages: + msg164994
2012-07-08 10:18:04pitroucreate