Object 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
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Object Memory Usage

Post by daven »

*waves* Hello all. Back again after my hiatus from PHP. Now on to my issue:

I am debugging an application which has hundreds (and theoretically thousands) of objects floating about. I would like to be able to determine the amount of memory the objects are consuming. ie -- memory_use($foo) returns the number of bytes $foo uses.

Any clues as to how to accomplish this?

Note:
Using PHP 4.*, primarily 4.3.* (the version varies across different boxes)

Thanks
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

memory_get_usage() will show it on a script level. I believe that is as low as you can go without a decent code profiler like the one that ships with Zend Studio.
Post Reply