Hi, When you go through the objects, do you remove them from the session with session.expire(obj)?
Hope this helps, João On Wed, 26 Feb 2020 at 17:09, Ahmed Cheikh <hajer.cheikhru...@gmail.com> wrote: > Hello Everybody, > > I used SQLAlchemy in one of my projects. And in this project, I loop over > many objects. I use for each object the same engine and session object to > query from my database. What I noticed is that for each loop, there is an > increase in the memory usage. > I checked all the other reasons that could potientially lead to a memory > leak and thee was none. So I was wondering if any of you faced such a > problem? And if so did you find any solution > > PS: I tried closing all my sessions after each iteration, delete session > object and then garbage collect it, dispose engine and even used the > recently added sqlalchemy.orm.session.close_all_sessions() > > Thx for your help. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/26f16790-685c-42aa-9c36-27970c838ffe%40googlegroups.com > <https://groups.google.com/d/msgid/sqlalchemy/26f16790-685c-42aa-9c36-27970c838ffe%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAJGrhWZRL5tJ-3Hw%2BN1YAgn8u6kJzPosW%3DcfdYyjJS6c2DML7w%40mail.gmail.com.