Re: Memory Leaks
| From: | Zeev Suraski | Date: | Fri, 20 Jul 2001 15:22:21 +0000 |
| Subject: | Re: Memory Leaks | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58922@lists.php.net to get a copy of this message | ||
Paul,
First off, this is definitely not what's killing your server. The reason for this is simple - the leak reports you see in the error log are only for debug purposes. PHP takes care of these leaks automatically, and frees these blocks. Such leaks are not a good thing (they imply there's an implementation bug in PHP), but thanks to PHP's safety net, they're not a very critical thing either.
Secondly, have you tried using PHP 4.0.6? Its memory handling should be significantly better than any of the previous PHP 4.0 versions.
Thirdly, in order to fix the leaks that happen on your web site, we'd need the smallest self-contained script (or set of scripts) that causes these messages to display. Looking at the code snippet that you've pasted, my guess is that the cause is not there, but in the required decision.php file, or in an auto prepended/appended file, that you might have. If you can take these files as a starting point, then cut them down as much as you can, removing any external dependencies, such as database connectivity (while checking at every step of the way that the leak still occurs) - chances are we'll be able to fix it quite quickly.
Zeev
At 18:44 20/07/2001, Paul Strange wrote:
On Friday 20 July 2001 07:22, Johnson, Kirk wrote:-- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/-----Original Message----- From: Paul Strange [mailto:paul.strange@level67.net] Sent: Thursday, July 19, 2001 1:18 PM To: php-general@lists.php.net Subject: [PHP] Memory Leaks When we review the error_log from apache, we see the following alot: zend_hash.c(291) : Freeing 0x0812738C (65 bytes), script=/www/dmp/app/index.php Last leak repeated 152 timesPaul, I was hoping to see a response to your post from one of our more "technical" list members. That's not me, unfortunately. We had a recent bout with this same thing. We have a home-grown database abstraction layer (written in C) that had some memory leaks. As soon as we fixed that code, these "Freeing" errors went away. That's the sum total of what I know about this, sorry :( Did you configure PHP with the --enable-debug switch? If not, you may want to try it, you may get some additional info into the error log. Good luck. Kirk Kirk, I checked our configuration with a phpinfo (). --enable-debug is there and part of the configuration. I have checked the error logs again and here is some more information: <<<<< Start error_log >>>>> zend_hash.c(291) : Freeing 0x08126FCC (65 bytes), script=/www/dmp/app/index.php Last leak repeated 274 times zend_compile.c(116) : Freeing 0x081230AC (30 bytes), script=/www/dmp/app/index.php Last leak repeated 4 times ./zend_execute.c(378) : Freeing 0x0818B04C (17 bytes), script=/www/dmp/app/index.php zend_variables.c(127) : Actual location (location was relayed) ./zend_execute.c(375) : Freeing 0x08121E44 (12 bytes), script=/www/dmp/app/index.php ./zend_execute.c(1517) : Freeing 0x081882BC (12 bytes), script=/www/dmp/app/index.php Last leak repeated 7 times ./zend_execute.c(1625) : Freeing 0x081556E4 (12 bytes), script=/www/dmp/app/index.php zend_hash.c(461) : Freeing 0x0818B094 (44 bytes), script=/www/dmp/app/index.php Last leak repeated 5 times zend_hash.c(202) : Freeing 0x0812280C (20 bytes), script=/www/dmp/app/index.php Last leak repeated 12 times ./zend_execute.c(1536) : Freeing 0x0818C4F4 (48 bytes), script=/www/dmp/app/index.php Last leak repeated 3 times zend_API.c(313) : Freeing 0x081581FC (6 bytes), script=/www/dmp/app/index.php Last leak repeated 17 times zend_API.c(309) : Freeing 0x081581BC (12 bytes), script=/www/dmp/app/index.php Last leak repeated 17 times php_mysql.c(1389) : Freeing 0x0817B044 (48 bytes), script=/www/dmp/app/index.php zend_API.c(188) : Actual location (location was relayed) ./zend_execute.c(140) : Freeing 0x08169974 (48 bytes), script=/www/dmp/app/index.php zend_variables.c(150) : Actual location (location was relayed) Last leak repeated 1 time zend_hash.c(433) : Freeing 0x081555C4 (16 bytes), script=/www/dmp/app/index.php zend_hash.c(427) : Freeing 0x08123B34 (35 bytes), script=/www/dmp/app/index.php Last leak repeated 2 times file.c(1922) : Freeing 0x0816A0B4 (9 bytes), script=/www/dmp/app/index.php zend_API.c(499) : Freeing 0x08160B3C (10 bytes), script=/www/dmp/app/index.php Last leak repeated 2 times zend_API.c(495) : Freeing 0x08122304 (12 bytes), script=/www/dmp/app/index.php Last leak repeated 2 times reg.c(534) : Freeing 0x08179EAC (48 bytes), script=/www/dmp/app/index.php zend_API.c(188) : Actual location (location was relayed) ./zend_execute.c(386) : Freeing 0x08121E84 (12 bytes), script=/www/dmp/app/index.php main.c(1083) : Freeing 0x08176DF4 (48 bytes), script=/www/dmp/app/index.php zend_API.c(188) : Actual location (location was relayed) main.c(1082) : Freeing 0x081222C4 (12 bytes), script=/www/dmp/app/index.php main.c(1137) : Freeing 0x0814561C (12 bytes), script=/www/dmp/app/index.php main.c(1119) : Freeing 0x081619B4 (47 bytes), script=/www/dmp/app/index.php main.c(1116) : Freeing 0x081609BC (12 bytes), script=/www/dmp/app/index.php main.c(1104) : Freeing 0x0812447C (48 bytes), script=/www/dmp/app/index.php zend_API.c(188) : Actual location (location was relayed) main.c(1103) : Freeing 0x08160A5C (12 bytes), script=/www/dmp/app/index.php php_variables.c(169) : Freeing 0x081608BC (12 bytes), script=/www/dmp/app/index.php Last leak repeated 111 times string.c(1964) : Freeing 0x08122E2C (29 bytes), script=/www/dmp/app/index.php Last leak repeated 111 times main.c(967) : Freeing 0x081609FC (48 bytes), script=/www/dmp/app/index.php zend_API.c(188) : Actual location (location was relayed) main.c(966) : Freeing 0x081641BC (12 bytes), script=/www/dmp/app/index.php php_variables.c(231) : Freeing 0x0814A0D4 (48 bytes), script=/www/dmp/app/index.php zend_API.c(188) : Actual location (location was relayed) Last leak repeated 1 time php_variables.c(230) : Freeing 0x0817092C (12 bytes), script=/www/dmp/app/index.php Last leak repeated 1 time main.c(1061) : Freeing 0x0814A9CC (48 bytes), script=/www/dmp/app/index.php zend_API.c(188) : Actual location (location was relayed) main.c(1060) : Freeing 0x08166254 (12 bytes), script=/www/dmp/app/index.php zend_ptr_stack.c(29) : Freeing 0x0815BBB4 (256 bytes), script=/www/dmp/app/index.php Last leak repeated 2 times zend_stack.c(27) : Freeing 0x0816B72C (256 bytes), script=/www/dmp/app/index.php Last leak repeated 5 times <<<<< End error_log >>>>> This stuff is killing our server. Our current solution is to bounce apache every 15 minutes. However if the traffic gets heavy, then all the memory gets sucked up and a reboot is required. I would greatly appreciate any help I could get on this matter as it is way beyond my skills. -- Paul Strange Lead Programmer Level 67 LC --- eMail: paul.strange@level67.net Office: 801.486.4686 Fax: 801.994.0467 -- 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