Without actually trying it, but it still seems the cause for memory
leak of (A) and (B) is different. (B) is a case of circular reference,
and as such reference counting garbage collection (cpython) will fail
to work properly.
But (A), which is the leak in web2py, does not seem to related to
circular reference.
(A)
>>code="""
>>class Foo(object):
>> def __del__(self):
>> pass
>>foo = Foo()
>>"""
>>while True: exec code in {}
>>
>>causes a memory leak. Web2py does this.
(B)
>>class Foo(object):
>> def __del__(self):
>> pass
>>while True:
>> foo = Foo()
>> foo.x = foo