diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2005-11-16 05:49:04 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-11-16 05:49:04 (GMT) |
commit | a3fd07d524dc37d7f3b2b0d1e6086109547b2ba6 (patch) | |
tree | 80151e14216a79e534fab0313e4a2dc73e54f84b /Python | |
parent | dee2fd54481b311ad831ac455a9192bdc0f147e3 (diff) | |
download | cpython-a3fd07d524dc37d7f3b2b0d1e6086109547b2ba6.zip cpython-a3fd07d524dc37d7f3b2b0d1e6086109547b2ba6.tar.gz cpython-a3fd07d524dc37d7f3b2b0d1e6086109547b2ba6.tar.bz2 |
add more doc
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Python/ast.c b/Python/ast.c index e5df906..87a9a4b 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -34,11 +34,32 @@ for (i = 0; i < asdl_seq_LEN(seq); i++) free_***(asdl_seq_GET(seq, i)); - asdl_seq_free(seq); + asdl_seq_free(seq); / * ok * / Almost all of the ast functions return a seq of expr, so you should use asdl_expr_seq_free(). The exception is ast_for_suite() which returns a seq of stmt's, so use asdl_stmt_seq_free() to free it. + + If asdl_seq_free is appropriate, you should mark it with an ok comment. + + There are still many memory problems in this file even though + it runs clean in valgrind, save one problem that may have existed + before the AST. + + Any code which does something like this: + + return ASTconstruct(local, LINENO(n)); + + will leak memory. The problem is if ASTconstruct (e.g., TryFinally) + cannot allocate memory, local will be leaked. + + There was discussion on python-dev to replace the entire allocation + scheme in this file with arenas. Basically rather than allocate + memory in little blocks with malloc(), we allocate one big honking + hunk and deref everything into this block. We would still need + another block or technique to handle the PyObject*s. + + http://mail.python.org/pipermail/python-dev/2005-November/058138.html */ /* Data structure used internally */ |