hi all, Here is 3 PYs, we found there is a big memory wasting, specially the program c.py, we found the memory will increase very soon. any body knows why? any RC's problem? thanks
-- eSX
class a(): def __init__(self): fp = open("a_file_lager_1M","rb") self.ll = fp.read() fp.close() self.h = b(self.aaa) def aaa(self): pass class b: def __init__(self,bbb): self.a = bbb #remove the "self.", the memory use will be very low! pass def c(): k=a() while True: c()
import haha import time def c(): b=haha.Client(["127.0.0.1"]) while True: # time.sleep(1) c()
#!/usr/bin/env python from threading import local class Client(local): def __init__(self, servers, debug=0): self.k = [_Host(s, self.debuglog) for s in servers] def debuglog(self, str): pass class _Host: def __init__(self, host, debugfunc=None): self.debuglog = debugfunc #a -> b b->a, make the memory be huge! pass
-- http://mail.python.org/mailman/listinfo/python-list