note 47780 modified in function.memory-get-usage by danbrown

From: Date: Sun, 20 Jul 2008 00:50:30 +0000
Subject: note 47780 modified in function.memory-get-usage by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141865@lists.php.net to get a copy of this message
[EDIT by danbrown AT php DOT net: This is intended by the author to only be used with PHP 4 < 4.3.2.] I'd just like to point out that although sandeepc at myrealbox dot com's idea for displaying the current memory usage is a good one, it's perhaps a bad idea to pipe the entire process list through grep. A better performing method would be to select only the process we're interested in: <?php $pid = getmypid(); error_log('MEMORY USAGE (% KB PID ): ' . ps --pid $pid --no-headers -o%mem,rss,pid); ?> True, it's not much of a performance boost, but every bit helps. --was-- I'd just like to point out that although sandeepc at myrealbox dot com's idea for displaying the current memory usage is a good one, it's perhaps a bad idea to pipe the entire process list through grep. A better performing method would be to select only the process we're interested in: <? $pid = getmypid(); error_log('MEMORY USAGE (% KB PID ): ' . ps --pid $pid --no-headers -o%mem,rss,pid); ?> True, it's not much of a performance boost, but every bit helps. http://php.net/manual/en/function.memory-get-usage.php

« previous php.notes (#141865) next »