[Python-bugs-list] [Bug #133489] compile leaks memory (current CVS)
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 23 Feb 2001 10:34:48 -0800
Bug #133489, was updated on 2001-Feb-21 13:10
Here is a current snapshot of the bug.
Project: Python
Category: Python Interpreter Core
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 7
Submitted by: effbot
Assigned to : bwarsaw
Summary: compile leaks memory (current CVS)
Details: while 1: compile("print 'hello'\n", "<string>", "exec")
run it. watch your computer run out of memory. enough said ;-) /F
Follow-Ups:
Date: 2001-Feb-23 10:34
By: bwarsaw
Comment:
Fixed in 2.169 of compile.c.
-------------------------------------------------------
Date: 2001-Feb-21 19:23
By: jhylton
Comment:
Based on inspection of the code, the following patch looks like it should
fix the problem. It appears that the very first PySymtableEntryObject (the
one created in symtable_build()) isn't getting cleaned up. It contains
pointers to all its children, so they aren't cleaned up either.
But if I apply this patch, the interpreter always crashes. It doesn't seem
to crash at the same place every time, but it always does. The stack trace
always points to a seg fault in malloc().
So I suspect the patch is correct and that the leak is masking some other
refcount bug. If you could apply the patch and diagnose the crash, I think
we'd make more progress.
Index: Python/compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.168
diff -c -r2.168 compile.c
***************
*** 4193,4198 ****
--- 4195,4201 ----
{
Py_XDECREF(st->st_symbols);
Py_XDECREF(st->st_stack);
+ Py_XDECREF(st->st_cur);
PyMem_Free((void *)st);
}
-------------------------------------------------------
Date: 2001-Feb-21 13:14
By: jhylton
Comment:
Can you do an insure pass?
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=133489&group_id=5470