Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42548 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82614 invoked from network); 11 Jan 2009 00:21:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2009 00:21:28 -0000 X-Host-Fingerprint: 85.21.236.169 xdmitri.dialup.corbina.ru Received: from [85.21.236.169] ([85.21.236.169:17939] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/40-26912-68B39694 for ; Sat, 10 Jan 2009 19:21:26 -0500 Message-ID: <8E.40.26912.68B39694@pb1.pair.com> To: internals@lists.php.net References: <200901101830.35403.thomas@koch.ro> Date: Sun, 11 Jan 2009 03:21:23 +0300 Lines: 34 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original X-Posted-By: 85.21.236.169 Subject: Re: php daemons, memory From: dmda@yandex.ru ("jvlad") > Since I use a MySQL connection, Syslog and many classes, I wanted to let > the script run a while before restarting. So the scripts had lines like: > > $i = 1000; > while( --$i ) > { > while( run() ); // run returns false if there are no pending jobs > gc_collect_cycles(); > // echo get_memory_usage(); > sleep( 20 ); > } > > - Was it a mistake to use PHP for such scripts? What language should I've > been > choosing instead? Almost. Try to compile your very-own-version of php, using configure argument --disable-zend-memory-manager also, disable _all_ php extensions that your scripts do not depend on. > > - --enable-debug did report some small leaks, but much less then the > consumption grow. zend memory manager won't release memory to the system. Memory held by ZMM quickly becomes fragmented into smaller chunks than needed, so it takes from the system more and more "fresh" memory. Definitely this approach is not for your situation (php daemons). -jv