On Mon, 2010-05-24 at 20:11 -0400, David Malcolm wrote:
On Thu, 2010-05-20 at 15:37 -0400, David Malcolm wrote:
[snip]
I'm working next on enabling more of the debug flags in the debug builds; you can see status on the under-construction feature page here: https://fedoraproject.org/wiki/DaveMalcolm/DebugPythonStacks
I've now enabled WITH_TSC, with COUNT_ALLOCS, and CALL_PROFILE for both python and python3 (see the wiki page above for the specific builds).
[david@surprise devel]$ python3-debug Python 3.1.2 (r312:79147, May 25 2010, 12:21:20) [GCC 4.4.3 20100422 (Red Hat 4.4.3-18)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import sys ; from pprint import pprint
[32089 refs]
pprint(sys.getcounts())
[('ImportError', 2, 2, 1), ('_Helper', 1, 0, 1), ('_Printer', 3, 0, 3), [snip] ('dict', 3671, 3325, 389), ('str', 16194, 12860, 3334), ('tuple', 13995, 12300, 1740)] [32101 refs]
One issue is that COUNT_ALLOCS seems to unconditionally log debug information to stdout on exit: memoryview alloc'd: 2, freed: 2, max in use: 1 ImportError alloc'd: 2, freed: 2, max in use: 1 _Helper alloc'd: 1, freed: 1, max in use: 1 _Printer alloc'd: 3, freed: 3, max in use: 3
which is likely to break scripts that capture stdout from python scripts.
It seems useful to have sys.getcounts(), so perhaps we should talk with upstream and instead emit counts to stderr instead, or make this only happen if an envvar is set, or simply omit it.
Thoughts? Dave