I was wondering if anyone has any tips about tracking memory leaks/issues in Silverstripe?
I have a site that I have built, its working well except that it seems to use a load of memory. I have been moitoring the system performance on the server, and at one point the CPU usage from apache went over 75%.
It only seems to do it every so often though. But the trouble is that sometimes it is crashing the server!!
There are many ways to start peeking at the internals, here are a couple:
1. Enable the built in profiler with the ?debug_profile=1 ( More at http://doc.silverstripe.com/doku.php?id=profiler )
2. Use php's built in memory monitoring functions, starting with memory_get_usage(): http://us2.php.net/manual/en/function.memory-get-usage.php
3. If the first 2 don't suit you, try using PEAR::Benchmark: http://pear.php.net/package/Benchmark
4. Install xdebug and get your IDE setup with remote debugging so you can use some variant of cachegrind to REALLY get under the hood. With Ubuntu this is pretty trivial as it is in the repos: http://ubuntu-snippets.blogspot.com/2008/06/debugging-php-using-xdebug.html
Full Details on cachegrinding: http://www.ibm.com/developerworks/opensource/library/os-php-fastapps2/