# Demonstrates a leak in the utf8 encoder. iters = 100000 encoding = "utf8" s = u"Ascii only string" import sys i=0 try: start = sys.gettotalrefcount() except AttributeError: print "You must run this under a debug build of Python" sys.exit(1) while i < iters: s.encode(encoding) i += 1 print "After %d iterations, lost %d references" % (iters, sys.gettotalrefcount()-start)

AltStyle によって変換されたページ (->オリジナル) /