Maybe unnecessary, but here's another test: + In foo.py: class Foo(object): def __del__(self): print 'Deleted'
def bar(self): print "bar::" b = Foo() def f(): print "local_func::" c = Foo() + In test.py: from foo import * a = Foo() a.bar() f() + Then, in interpreter: >>> execfile('test.py',{}) bar:: Deleted local_func:: Deleted Deleted ============== It looks like all variables a, b, and c are properly destroyed. Is this the pattern of usage in web2py? (1) No class in controller. (2) External classes are imported using local_import (does local_import work exactly like import?). If so, I think webp2y is okay with respect to memory leak.