Re: Memory eating
| From: | Faisal Nasim | Date: | Sun, 09 Apr 2000 05:28:01 +0000 |
| Subject: | Re: Memory eating | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-17757@lists.php.net to get a copy of this message | ||
Hi,
: If PHP (or Perl, for that matter) was interpreting scripts line by line,
: then you would have been correct, but it doesn't. It generates an
: 'execution plan' for the code, and this execution plan may take
: considerable memory. If your logic is 'dumb', i.e., lots and lots of
: flat-logic statements, then it's not very efficient (in fact, PHP/FI 2.0
: would probably be the most efficient in this case). It's not an
: interesting case to optimize for, since it's not similar at all to the
: general case.
Thats smart!
Nobody should build a script like that, but.... just wanted
to know the reason, and the reason is perfect! :)
Thanks again.
Faisal
:
: Zeev
:
: At 07:03 09/04/2000 , Faisal Nasim wrote:
: >Hi,
: >
: >Did a sample test in both Perl and PHP, they both eat
: >alot of memory:
: >
: >PHP:
: ><?
: >$fas1=1;
: >echo $fas1;
: >unset($fas1);
: >$fas2=2;
: >echo $fas2;
: >unset($fas2);
: >$fas3=3;
: >echo $fas3;
: >unset($fas3);
: >.
: >.
: >.
: >to $fas20000 ......
: >?>
: >
: >Perl:
: >
: >$fas1=1;
: >print $fas1;
: >undef $fas1;
: >.
: >.
: >.
: >to $fas20000
: >
: >PHP's maximum consumption goes to 12mb and Perl goes
: >upto 23mb (same result 4 times). But it should not take more
: >than 2-3mb (okay not more than 5mb, assuming it loads the
: >modules and stuff at the startup). In both PHP and Perl, the
: >memory increases as it finds more variables, but we are
: >undef()ing and unset()ting them too, aren't they (cleaned
: >completely|freed for good)? Any ideas?
: >
: >Platform: Windows.
: >
: >Note: Tried to try the same thing with Python, works for
: >10 seconds; memory level rises slowly to 13mb, and then
: >boom - it crashes. Python script:
: >
: >fas1=1;
: >print fas1;
: >del fas1;
: >.
: >.
: >.
: >to fas20000
: >
: >
: >Thanks.
: >
: >Faisal