for proj in projects:
    if sample.filename.startswith(proj.abs_source):
        sample.filename = 'some other path'
offset += N
session.flush()
session.expunge_all()
Is this a memory leak ( a program in python with sqlalchemy/sqlite)