|
Posted by Nico on 10/12/05 09:06
Hi,
I'm using PHP for 8 months now and (still) have 2 newbee questions.
At the end of my script I measure the memory usage.
$mem = memory_get_usage() / 1096;
$mem = number_format($mem, 3, ".", ","). " kB";
The end result is:
<!--
Exec. time script: 0.053 sec.
Allocated mem: 492.036 kB
-->
I spent some time with my Zend Studio debugger and profiler. In the
script I use a method to retrieve phrases (yes, it's a multi language
application), which consumes quite some mem. To decrease memory
consumption, I payd special attention to unset()ting vars in the code.
However, according to my debugger and watch, the memory is not actually
released after unsetting a var.
In my debugger, I see that each time the method is called, for each
executed line the used memory is increased.
My questions:
1) Are there ways to release vars / give mem back to the system during
execution and in that way decrease memory usage / decrease performance
?
2) Can I force a garbage collector to actually do it's job ? Read the
docs, but didn't find info about it. Maybe I need new glasses ;)
Any suggestion would be appriciated...
BTW; I'm developing on a SuSe Linux prof. machine and using MySql
4.1.10 + PHP5. At this moment, the database is small, but after
deployment it will be a large database and much traffic, so performance
is quite important.
Kind regards,
Nico
Navigation:
[Reply to this message]
|