1 import gc 2 3 class old_style_class(): 4 pass 5 class new_style_class(object): 6 pass 7 8 a = old_style_class() 9 del a 10 gc.collect() 11 b = new_style_class() 12 del b 13 gc.collect() 14 15 a = old_style_class() 16 del old_style_class 17 gc.collect() 18 b = new_style_class() 19 del new_style_class 20 gc.collect() 21 del a 22 gc.collect() 23 del b 24 gc.collect() 25