diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-18 06:24:08 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-18 06:24:08 (GMT) |
commit | 45294a9562e5c360ee8ef8498d8792e05a6eb25e (patch) | |
tree | bc3aea94480f2eb7507cf77d86a4975d29d9e871 /Python/pythonrun.c | |
parent | 041669fa67198a5bf18da962ea19edb2af3f7e9d (diff) | |
download | cpython-45294a9562e5c360ee8ef8498d8792e05a6eb25e.zip cpython-45294a9562e5c360ee8ef8498d8792e05a6eb25e.tar.gz cpython-45294a9562e5c360ee8ef8498d8792e05a6eb25e.tar.bz2 |
Remove types from type_list if they have no objects
and unlist_types_without_objects is set.
Give dump_counts a FILE* argument.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index b98d6fb..0a81809 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -311,7 +311,7 @@ Py_Initialize(void) #ifdef COUNT_ALLOCS -extern void dump_counts(void); +extern void dump_counts(FILE*); #endif /* Undo the effect of Py_Initialize(). @@ -373,6 +373,13 @@ Py_Finalize(void) * XXX I haven't seen a real-life report of either of these. */ PyGC_Collect(); +#ifdef COUNT_ALLOCS + /* With COUNT_ALLOCS, it helps to run GC multiple times: + each collection might release some types from the type + list, so they become garbage. */ + while (PyGC_Collect() > 0) + /* nothing */; +#endif /* Destroy all modules */ PyImport_Cleanup(); @@ -401,7 +408,7 @@ Py_Finalize(void) /* Debugging stuff */ #ifdef COUNT_ALLOCS - dump_counts(); + dump_counts(stdout); #endif PRINT_TOTAL_REFS(); |