I have an application where large amounf of data is loaded into the database by CLI tasks that runs frequently. The case is that we loop over the list and insert the data into the database. The model we use to create the data in the Db performs a number of sum calculations, from other models. From time to time this job runs out of memory, so we have been running a Xdebug profiling, which is seen in the dump below.
It seems that Model::_groupResult accumulates quite alot of memory with an increasing number of calls, the main callers from this is the Model::sum function, is there anyway to reduce/prevent this or release memory?
I'm not quite sure of the functionality of _groupResult, but would it be better to write a PHQL statement wich include the sum function or would this be same?
Thanks in advance