Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.0

Bug #18036 Memleak in System_Daemon::info()
Submitted: 2010-11-09 12:02 UTC Modified: 2010-11-09 12:11 UTC
From: kkszysiu Assigned: kvz
Status: Closed Package: System_Daemon (version 0.10.3)
PHP Version: 5.2.6 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2010-11-09 12:02 UTC] kkszysiu (Krzysztof Klinikowski)
Description: ------------ Hello. I'm using System_Daemon to demonise our php scipts but we're suffering on regular crashes caused by PHP fatals - "Allowed memory size of 134217728 bytes exhausted (tried to allocate 1572868 bytes)". I checked that using simple script attached do that bug report and it seems that your logging functions are fault of that memleak. More about it: http://stackoverflow.com/questions/4113776/php-daemon-possible-memory-leak/4125427#4125427 Test script: --------------- #!/usr/bin/php -q <?php require_once "System/Daemon.php"; System_Daemon::setOption("appName", "smsd"); System_Daemon::start(); while(!System_Daemon::isDying()) { System_Daemon::info("debug: memory_get_peak_usage: ".memory_get_peak_usage()."\n"); System_Daemon::info("debug: memory_get_usage: ".memory_get_usage()."\n\n"); System_Daemon::iterate(2); } Expected result: ---------------- Well, memory_get_peak_usage should not growing. When we use "print" function from PHP it works well but with System_Daemon::info() memory usage is growing fast. Actual result: -------------- [Nov 08 16:46:00] info: debug: memory_get_peak_usage: 999304 [Nov 08 16:46:00] info: debug: memory_get_usage: 934564 [Nov 08 16:46:02] info: debug: memory_get_peak_usage: 999400 [Nov 08 16:46:02] info: debug: memory_get_usage: 934564 [Nov 08 16:46:04] info: debug: memory_get_peak_usage: 999496 [Nov 08 16:46:04] info: debug: memory_get_usage: 934564 [Nov 08 16:46:06] info: debug: memory_get_peak_usage: 999592 [Nov 08 16:46:06] info: debug: memory_get_usage: 934564 [Nov 08 16:46:08] info: debug: memory_get_peak_usage: 999688 [Nov 08 16:46:08] info: debug: memory_get_usage: 934564 [Nov 08 16:46:10] info: debug: memory_get_peak_usage: 999784 [Nov 08 16:46:10] info: debug: memory_get_usage: 934564 [Nov 08 16:46:12] info: debug: memory_get_peak_usage: 999880 [Nov 08 16:46:12] info: debug: memory_get_usage: 934564 [Nov 08 16:46:14] info: debug: memory_get_peak_usage: 999976 [Nov 08 16:46:14] info: debug: memory_get_usage: 934564 [Nov 08 16:46:16] info: debug: memory_get_peak_usage: 1000072 [Nov 08 16:46:16] info: debug: memory_get_usage: 934564 [Nov 08 16:46:18] info: debug: memory_get_peak_usage: 1000168 [Nov 08 16:46:18] info: debug: memory_get_usage: 934564 [Nov 08 16:46:20] info: debug: memory_get_peak_usage: 1000264 [Nov 08 16:46:20] info: debug: memory_get_usage: 934564 [Nov 08 16:46:22] info: debug: memory_get_peak_usage: 1000360 [Nov 08 16:46:22] info: debug: memory_get_usage: 934564 (...)

Comments

 [2010-11-09 12:11 UTC] kvz (Kevin van Zonneveld)
-Status: Open +Status: Closed -Assigned To: +Assigned To: kvz
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. http://stackoverflow.com/questions/4113776/php-daemon-possible-memory- leak/4132951#4132951