I currently have a PHP CLI script using Zend Framework extensively which seems to be using a ever larger amount of memory as it runs. It loops through a large set of models retrieved from a database in batches of 1000. Calls to memory_get_usage()
show that the memory usage of the script is always increasing.
This is despite making sure that I'm unsetting the model after every iteration and actually using array_shift()
to reduce the size of the array of models on every iteration.
My question is, in PHP is there a way of discovering the size-in-memory of a variable so I can track what's growing?