Re: OOP Static Functions vs. Objects
| From: | Richard Lynch | Date: | Mon, 01 May 2006 20:53:16 +0000 |
| Subject: | Re: OOP Static Functions vs. Objects | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235213@lists.php.net to get a copy of this message | ||
On Mon, May 1, 2006 8:25 am, Edward Vermillion wrote:
> What I was mainly thinking of though, what kind of hoops does PHP
> jump through to take a class, that I assume it's holding in memory,
> and make an object out of it, aside from the constructor? Is it
> doubling the memory consumption, or more, to do that by having the
> class and an object ready to work on? Are objects stored differently
> from included classes? Or is it treating it like object references(?)
> and only making a copy when it's necessary? Or something else
> entirely?
I don't know exactly how PHP handles a static function -- whether it
has a ghost instance laying around, or cached as needed, or maybe they
just fake it with a bogus object and call settype() on it a lot.
I don't think you need to worry about having a single "extra" instance
of every class.
You generally only get into trouble when you start building factories
churning out a zillion instances of some classes.
I think you'd have to REALLY work at it and screw up Design big-time
to get enough classes that the overhead of just the class itself would
take all your RAM.
--
Like Music?
http://l-i-e.com/artists.htm