> 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 



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to