compile leaks memory. lots of memory.
It would be helpful to get some analysis on this known problem before the beta release.
It looks like there is a leak of symtable entries. In particular, symtable_enter_scope has if (st->st_cur) { prev = st->st_cur; if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { Py_DECREF(st->st_cur); st->st_errors++; return; } } st->st_cur = (PySymtableEntryObject *)\ PySymtableEntry_New(st, name, type, lineno); if (strcmp(name, TOP) == 0) st->st_global = st->st_cur->ste_symbols; if (prev) if (PyList_Append(prev->ste_children, (PyObject *)st->st_cur) < 0) st->st_errors++; First, it seems that Py_XDECREF(prev); is missing. That alone does not fix the leak, though, since prev is always null in the test case. The real problem comes from st_cur never being released, AFAICT. There is a DECREF in symtable_exit_scope, but that function is not called in the test case - symtable_enter_scope is called. For symmetry reasons, it appears that there should be a call to symtable_exit_scope of the global scope somewhere (which apparently is build in symtable_build). I can't figure how what the correct place for that call would be, though. Regards, Martin
"MvL" == Martin von Loewis <loewis@informatik.hu-berlin.de> writes:
MvL> The real problem comes from st_cur never being released, MvL> AFAICT. There is a DECREF in symtable_exit_scope, but that MvL> function is not called in the test case - MvL> symtable_enter_scope is called. For symmetry reasons, it MvL> appears that there should be a call to symtable_exit_scope of MvL> the global scope somewhere (which apparently is build in MvL> symtable_build). I can't figure how what the correct place MvL> for that call would be, though. Martin, I believe you've hit the nail on the head. My latest Insure run backs this theory up. It even claims that st_cur is lost by the de-allocation of st in PySymtable_Free(). I'm betting that Jeremy will be able to quickly figure out where the missing frees are when I send him the Insure report. -Barry
participants (2)
-
barry@digicool.com
-
Martin von Loewis