Re: Memory/Object question
| From: | (Richard Lynch) | Date: | Fri, 10 Nov 2000 00:06:54 +0000 |
| Subject: | Re: Memory/Object question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24583@lists.php.net to get a copy of this message | ||
In article <Pine.LNX.4.10.10011091055280.1098-100000@one.ctelcom.net>,
bughuntr@one.ctelcom.net (Bug Hunter) wrote:
> I'm working on a program that will be running for a while (days) (using
> php in a cgi mode).
>
> If I have an object in an array and do the following:
>
> obj2 = new obj;
>
> obj["1"] = obj2;
>
> If obj["1"] already existed, what happens to it? does it lay around
> consuming memory, or is it destroyed?
In PHP 3, it laid around.
In PHP 4, it should get destroyed, almost-for-sure.
> Or does the data in the object get copied? If not, can I make the data
> get copied so I don't eat up memory, without doing a variable at a time?
You may be able to dink around with & and get less copy-construction going
on in some places, but I doubt that you can do it in this particular
example.
How sure are you that you need your script to run for days? Could it be
turned into a cron job that ran every few minutes instead?
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)