Wiedmann wrote:"memory_limit" is not availible on Windows (at the moment).
It seems that the new version 5.1.3 of PHP has the "--enable_memory_limit" possibility. But the binaries on the php site doesn't have compiled with this tag.
Wiedmann wrote:It seems that the new version 5.1.3 of PHP has the "--enable_memory_limit" possibility. But the binaries on the php site doesn't have compiled with this tag.
You are right. I have build a 5.1.4 with "--enable_memory_limit" and it's really working (with XP, no test with Win9x yet)
Does your built version with "--enable_memory_limit" will be intergrate in the future version of xampp ?
if( !function_exists('memory_get_usage') )
//If its Windows
//Tested on Win XP Pro SP2. Should work on Win 2003 Server too
//Doesn't work for 2000
//If you need it to work for 2000 look at http://us2.php.net/manual/en/function.memory-get-usage.php#54642
if ( substr(PHP_OS,0,3) == 'WIN')
if ( substr( PHP_OS, 0, 3 ) == 'WIN' ):
$output = array();
exec( 'tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output );
return preg_replace( '/[\D]/', '', $output ) * 1024;
//We now assume the OS is UNIX
//Tested on Mac OS X 10.4.6 and Linux Red Hat Enterprise 4
//This should work on most UNIX systems
$pid = getmypid();
exec("ps -eo%mem,rss,pid | grep $pid", $output);
$output = explode(" ", $output);
//rss is given in 1024 byte units
return $output * 1024;
Users browsing this forum: No registered users and 68 guests