This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: GC stats not accurate because of debug overhead
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou, tseaver
Priority: normal Keywords: patch

Created on 2008-12-17 23:06 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
gc_stats_fix.patch pitrou, 2008-12-17 23:06
Messages (3)
msg77993 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-12-17 23:06
With gc.DEBUG_STATS, each GC collection displays the elapsed time.
Unfortunately, this elapsed time includes the debug overhead itself,
most notable the calls to gc_list_size() which can be quite expensive
with lots of objects in the older generation. Consequently, collections
of generation 0 will incorrectly appear as very expensive, while in
non-debug mode they are very cheap.

Here is a patch to get a more useful output, by not including the time
taken in gc_list_size().
msg104797 - (view) Author: Tres Seaver (tseaver) * Date: 2010-05-02 19:29
The patch looks obviously correct to me.

I can confirm that the patch applies cleanly both to the trunk and to the 'release26-maint' branch, and that the 'test_gc' tests pass in both cases after applying it and rebuilding.
msg104800 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-02 20:07
Thank you. Now committed in r80704 (trunk), r80705 (py3k), r80706 (2.6), r80707 (3.1).
History
Date User Action Args
2022-04-11 14:56:42adminsetgithub: 48937
2010-05-02 20:07:46pitrousetstatus: open -> closed
versions: + Python 3.1, Python 3.2
messages: + msg104800

resolution: fixed
stage: patch review -> resolved
2010-05-02 19:32:12tseaversetversions: + Python 2.6
2010-05-02 19:29:53tseaversetnosy: + tseaver
messages: + msg104797
2008-12-17 23:06:18pitroucreate