weird memory leak
Jeremie Roux
jeremie at jarna.com
Tue Jan 22 14:54:14 EST 2002
I have this program that leaks in a weird way:
it runs at about 80% of my CPU and after a little while (maybe 5 or 10
minutes) starts leaking (pretty big: about 1MB/minute)
If I run it with less threads, the CPU load goes down, the time it
takes to start leaking increases, and the leak is not as bad. And
eventually, if I run it single threaded, I can leave it run for days
without seing any leak (I haven't left it run longer than a week
though).
Does anyone have any idea about that? Am i doing anything wrong?
Jeremie
PS: I am running python2.1 on freebsd
####### here is my code ##########
#! /usr/bin/env python
import imaplib
import time
import threading
import sys
def work():
while 1:
try:
ImapLib = imaplib.IMAP4('mail.jarna.com', 143)
typ, dat = ImapLib.logout()
except:
print 'exception: %s' % sys.exc_info()[1]
if __name__=='__main__':
threads = []
for i in xrange(1, 21):
t = threading.Thread(target=work)
t.setDaemon(1)
t.start()
threads.append(t)
while 1:
time.sleep(10)
More information about the Python-list
mailing list