File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434
3535 for (i = 0; i < asdl_seq_LEN(seq); i++)
3636 free_***(asdl_seq_GET(seq, i));
37- asdl_seq_free(seq);
37+ asdl_seq_free(seq); / * ok * /
3838
3939 Almost all of the ast functions return a seq of expr, so you should
4040 use asdl_expr_seq_free(). The exception is ast_for_suite() which
4141 returns a seq of stmt's, so use asdl_stmt_seq_free() to free it.
42+
43+ If asdl_seq_free is appropriate, you should mark it with an ok comment.
44+
45+ There are still many memory problems in this file even though
46+ it runs clean in valgrind, save one problem that may have existed
47+ before the AST.
48+
49+ Any code which does something like this:
50+
51+ return ASTconstruct(local, LINENO(n));
52+
53+ will leak memory. The problem is if ASTconstruct (e.g., TryFinally)
54+ cannot allocate memory, local will be leaked.
55+
56+ There was discussion on python-dev to replace the entire allocation
57+ scheme in this file with arenas. Basically rather than allocate
58+ memory in little blocks with malloc(), we allocate one big honking
59+ hunk and deref everything into this block. We would still need
60+ another block or technique to handle the PyObject*s.
61+
62+ http://mail.python.org/pipermail/python-dev/2005-November/058138.html
4263*/
4364
4465/* Data structure used internally */
You can’t perform that action at this time.
0 commit comments