Re: Array usage affecting server
| From: | Miguel Cruz | Date: | Fri, 10 May 2002 08:24:35 +0000 |
| Subject: | Re: Array usage affecting server | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96919@lists.php.net to get a copy of this message | ||
On Fri, 10 May 2002, Kevin Meredith wrote:
> When a database query is done and the results are put into an array, what
> are the resources used? I name all arrays differently and was wondering how
> it would affect the performance of the server if many people connected with
> many arrays being full. I am assuming the array gets 'dropped' when you
> connect to another page but if I keep on the same page using PHP_SELF?
At the end of each script run all variables are discarded and the memory
becomes eligible for garbage collection. So it doesn't make a difference
whether you keep posting back to PHP_SELF or you follow a twisty path from
one script to the next.
Of course, at any given point, you may still be using a lot of memory if
you are being inefficient or you need to handle an awful lot of data.
You can unset arrays you no longer need, and you can just generally look
at how you're storing data to determine that it provides the best balance
of resource usage.
miguel