From: Ilia Alshanetsky Date: Tue, 30 May 2006 14:51:20 +0000 (+0000) Subject: Added memory_get_peak_usage() function for retrieving peak memory usage of X-Git-Tag: php-5.2.0RC1~423 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5186ee9c5987425a99ae7f79ee13a3a9c6af87b1;p=php Added memory_get_peak_usage() function for retrieving peak memory usage of a PHP script. --- diff --git a/NEWS b/NEWS index 18fe4d1a78..0588b8358e 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2006, PHP 5.2.0 +- Added memory_get_peak_usage() function for retrieving peak memory usage of + a PHP script. (Ilia) - Changed Apache 2 Handler SAPI to call ap_set_content_type() once only. (Mike) - Changed E_ALL error reporting mode to includes E_RECOVERABLE_ERROR. (Marcus) - Added control character checks for cURL extension's open_basedir/safe_mode diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 134b34c926..c0a0efcf09 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -466,6 +466,7 @@ zend_function_entry basic_functions[] = { PHP_FE(print_r, NULL) #if MEMORY_LIMIT PHP_FE(memory_get_usage, NULL) + PHP_FE(memory_get_peak_usage, NULL) #endif PHP_FE(register_shutdown_function, NULL) diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h index 74f9bcb3d8..42f1be5c21 100644 --- a/ext/standard/php_var.h +++ b/ext/standard/php_var.h @@ -30,6 +30,7 @@ PHP_FUNCTION(serialize); PHP_FUNCTION(unserialize); #if MEMORY_LIMIT PHP_FUNCTION(memory_get_usage); +PHP_FUNCTION(memory_get_peak_usage); #endif PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC); diff --git a/ext/standard/var.c b/ext/standard/var.c index 5a8bb152fd..db9fd60473 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -918,6 +918,12 @@ PHP_FUNCTION(memory_get_usage) { RETURN_LONG(AG(allocated_memory)); } /* }}} */ +/* {{{ proto int memory_get_peak_usage() + Returns the peak allocated by PHP memory */ +PHP_FUNCTION(memory_get_peak_usage) { + RETURN_LONG(AG(allocated_memory_peak)); +} +/* }}} */ #endif /*