Re: php daemons, memory

From: Date: Sun, 11 Jan 2009 00:21:23 +0000
Subject: Re: php daemons, memory
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-42548@lists.php.net to get a copy of this message
> 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

« previous php.internals (#42548) next »