Skip to main content

traceback_clear

Clear traceback frames to prevent memory leaks.

def traceback_clear(
exc: Exception = None
) - > null

Clear traceback frames to prevent memory leaks. MEMORY LEAK FIX: This function helps break reference cycles between traceback objects and frame objects that can prevent garbage collection. Clearing frames releases local variables that may be holding large objects.

Parameters​

NameTypeDescription
excException = NoneThe exception object containing the traceback to be cleared; if not provided, the function retrieves the current exception information from sys.exc_info().

Returns​

TypeDescription
nullNothing is returned; the function performs in-place clearing of traceback frame data.