object leak with objectstore.clear and selecting from a mapper

Issue #170 resolved
Former user created an issue

I noticed that only linux (using cxOracle) there's an object leak with a specific kind of usage.

from sqlalchemy import *
import gc

engine = create_engine('oracle://dsn=somedb&user=myuser&password=mypass')

foo = Table('foo', engine,
    Column('id', Integer, Sequence('foo_seq'), primary_key=True),
    )

try: foo.drop()
except: pass
try: foo.create()
except: pass

foo.insert().execute()

class Foo(object): pass
foos = mapper(Foo, foo)

while 1:
    foos.select()
    gc.collect()
    objectstore.clear()
    gc.collect()
    print len(gc.get_objects())

The output of the programm is the ever increasing number of objects until it crashes due to out of memory exception (if you don't ctrl+c before)

This may need confirmation for other databases and linux distributions (mine is RedHat EL4)

Comments (2)

  1. Mike Bayer repo owner

    my instinct is that this bug is a duplicate of #168, which has been fixed, although the test program does not seem to have the circular reference which is the main catalyst for that particular issue. Nevertheless, I have run this program on Fedora Core 4 with cx_Oracle 4.1 and oracle XE 10.2 and the memory usage does not grow, the output of the program is an unchanging repeated value of "12927".

  2. Log in to comment