PHP Memory Usage

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
uncleben
Forum Newbie
Posts: 1
Joined: Tue Sep 14, 2010 6:28 am

PHP Memory Usage

Post by uncleben »

Hi,

I have a question regarding php memory usage.

At the moment, I have a website that is reporting very high memory usages using the linux top command (over 25 meg per request !!!) and I need to identify why and what is the source of this problem.

To start trouble shooting, I ran the php command memory_get_peak_usage in my index page which reported 8.5 meg as the max.

The index page includes class files, does some processing and so on. Normal stuff you would expect.

My question is, does this value include the memory usage used by all class calls. So, if I have some a call to $customer->getTotalSpend() in the index page which totals the spend of the current customer, would the total memory usage shown include that used by this class or do I need to output the memory allocation in each class file/script/include.

Any help/tips to resolving this issue is much appreciated.

Cheers

Uncle Ben
Post Reply