1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
import gc
import inspect
exclude = [
"function",
"type",
"list",
"dict",
"tuple",
"wrapper_descriptor",
"module",
"method_descriptor",
"member_descriptor",
"instancemethod",
"builtin_function_or_method",
"frame",
"classmethod",
"classmethod_descriptor",
"_Environ",
"MemoryError",
"_Printer",
"_Helper",
"getset_descriptor",
"weakref", "property", "cell", "staticmethod",
"WidgetFlags", "staticmethod"
]
def dumpObjects():
gc.collect()
oo = gc.get_objects()
for o in oo:
if getattr(o, "__class__", None):
name = o.__class__.__name__
#print (name)
#if name not in exclude:
if name in ["WebBoard", "WebBoardConfig", "WebBoardHistory"]:
filename = inspect.getabsfile(o.__class__)
logging.critical("Object :", `o`, "...")
logging.critical("Class :", name, "...")
logging.critical("defined:", filename, "\n")
|