I'm using PHP + Zend Framework for several CLI daemons. They take up quite a bit of memory. I'm assuming the Zend Framework part might be causing this, but I want to have facts showing me where the memory is wasted.
How can I determine where memory is wasted? Is this just a trial + error process? Also how can I improve garbage collection (I read some articles that this might also be an issue causing big memory usage).
I'd recommend using XDebug's profiler, which should give you the answers you need.
The profiler will generate a cachegrind file, which you can view in a tool such as KCacheGrind to see where your program's bottlenecks and memory usages are.
Find out more on XDebug's profiler page: http://www.xdebug.org/docs/profiler