MAX = 100000 import thread import time import sys class foo(object): def __init__(self, n): self.n = n __slots__ = ['n'] def run(*args): o = None for i in xrange(MAX): o = foo(o) print 'alloc OK' del o print 'dealloc OK' thread.exit() if __name__ == '__main__': thread.start_new_thread(run, ()) time.sleep(3)