Thread Memory Leak

Skip Montanaro skip at pobox.com
Tue Jun 25 15:11:08 CEST 2002


    Marco> while 1:
    Marco>     listThread = []

    Marco>     for i in range(50):
    Marco>         listThread.append( threading.Thread( None, runthread ) )
    Marco>     for i in listThread:
    Marco>         i.start()
    Marco>     for i in listThread:
    Marco>         i.join()

    Marco>     pid = os.getpid()
    Marco>     print "==================================="
    Marco>     os.system( "ps -o vsize,rss %d" % pid )

You never remove any thread objects from your listThread list.  It fills up
with completed threads.

-- 
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html





More information about the Python-list mailing list