Re: Memory/Object question
| From: | jeremy brand | Date: | Fri, 10 Nov 2000 00:08:56 +0000 |
| Subject: | Re: Memory/Object question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-24586@lists.php.net to get a copy of this message | ||
I have big jobs running in PHP cgi mode myself. I can't for sure say
that your example will free up, but in all of my testing where PHP3
did not free up -- even with unset()ing variables in PHP3, PHP4 clears
up -- without unset()ing. It's garbage colection is wonderful.
You might want to search the archives for one of the times when I
said "PHP4 Rocks".
-jeremy brand
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html
for more
---------------------------------------------------------------------
We cannot do everything at once, but we can do something at once.
-- Calvin Coolidge
> 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!)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>