<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">I noticed that only linux (using cxOracle) there's an object leak with a specific kind of usage.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from sqlalchemy import *
import gc

engine = create_engine('oracle://dsn=somedb&amp;user=myuser&amp;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())"><pre class="notranslate"><code class="notranslate">from sqlalchemy import *
import gc

engine = create_engine('oracle://dsn=somedb&amp;user=myuser&amp;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())
</code></pre></div>
<p dir="auto">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)</p>
<p dir="auto">This may need confirmation for other databases and linux distributions (mine is RedHat EL4)</p>
<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">When I try to use objects linked by relation with backref memory is not released neither after objectstore.flush() nor objectstore.clear() nor objectstore.expunge() nor gc.collect()<br>
When I break backref relation memory cleared by gc.collect() good.<br>
Bug reproduced by usage User/Address objects from your tests.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="for i in xrange(1000):
  objectstore.push_session(objectstore.Session())
  for j in xrange(1000):
    u = User()
    u.name = str(randint(0, 100000000))
    for k in xrange(10):
      a = Address()
      a.email_address = str(randint(0, 100000000))
      a.user = u
  objectstore.pop_session() 
  gc.collect()  "><pre class="notranslate"><code class="notranslate">for i in xrange(1000):
  objectstore.push_session(objectstore.Session())
  for j in xrange(1000):
    u = User()
    u.name = str(randint(0, 100000000))
    for k in xrange(10):
      a = Address()
      a.email_address = str(randint(0, 100000000))
      a.user = u
  objectstore.pop_session() 
  gc.collect()  
</code></pre></div>
<p dir="auto">with backrefs memory grows intensivelly and does not released</p>