Name
set_debug
Synopsis
set_debug(flags
)
Sets the debugging flags for garbage collection.
flags
is an integer, a bit string composed
by ORing (with Python’s normal bitwise-OR operator
|
) zero or more of the following constants exposed
by module gc
:
-
DEBUG_COLLECTABLE
Prints information on collectable objects found during collection
-
DEBUG_INSTANCES
Meaningful only if
DEBUG_COLLECTABLE
and/orDEBUG_UNCOLLECTABLE
are also set: prints information on objects found during collection that are instances of classic Python classes-
DEBUG_LEAK
The set of debugging flags that make the garbage collector print all information that can help you diagnose memory leaks, equivalent to the inclusive-OR of all other constants (except
DEBUG_STATS
, which serves a different purpose)-
DEBUG_OBJECTS
Meaningful only if
DEBUG_COLLECTABLE
and/orDEBUG_UNCOLLECTABLE
are also set: prints information on objects found during collection that are not instances of classic Python classes-
DEBUG_SAVEALL
Saves all collectable objects to list
garbage
(uncollectable ones are always saved there) to help diagnose leaks-
DEBUG_STATS
Prints statistics during collection to help tune the thresholds
-
DEBUG_UNCOLLECTABLE
Prints information on uncollectable objects found during collection
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.