it is really unintuitive to me why after flush() the memory get increased instead of decreased? I cannot find anything useful in the documentation. I am flushing every 50 loop iterations and after each flush memory usage is being increased by 1MB. 100 flushing uses 100MB ! What am I missing here? I have seen on doctrine’s website example with clear(), but it if I use it I got an exception that one of my object does not have cascade persist set. Could anyone explain me what is done behind the scenes and what should I do to properly unset all doctrine’s objects?
it is really unintuitive to me why after flush() the memory get increased instead
Share
The problem is, that the entity manager handles all objects. You should reset it if you dont need the objects in ram after each X iterations. Try this out: