[Twisted-web] memory leak with metaclass

Tazzo tazzo at email.it
Sat Jun 25 14:39:26 MDT 2005


We use metaclass for building on the fly new rendering pages and
we found a memory leak.
Managing with garbage collector we found that new classes are not released
for unknown reason.
Here a basic source that leak memory:

#-----------------------
print 'running server'
import nevow
from nevow import appserver
from twisted.application import service
from twisted.application import internet
 
class Controller(nevow.rend.Page):
  def locateChild(self,context,segments):
    return
type('Leaker',(nevow.rend.Page,),{'docFactory':nevow.loaders.stan(nevow.tags.h1['I
leak memory'])})(),[]
 
 
application=service.Application('leaker')
webservice = internet.TCPServer(12345,appserver.NevowSite(Controller()))
webservice.setServiceParent(application)
 
 
##AND USE THIS FOR SEE MEMORY LEAK
 
##import urllib
##for i in range(99999):
##  urllib.urlopen('http://localhost:12345/')

#-----------------------



Is it a bug?
Is there any way to avoid the memory leak?

#tazzo 
#http://www.pytypus.org/

 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Occhialeria.it
Scopri le migliori marche a prezzi imbattibili
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=879&d=20050625





More information about the Twisted-web mailing list