]> granicus.if.org Git - php/commitdiff
Added memory_get_peak_usage() function for retrieving peak memory usage of
authorIlia Alshanetsky <iliaa@php.net>
Tue, 30 May 2006 14:51:20 +0000 (14:51 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 30 May 2006 14:51:20 +0000 (14:51 +0000)
a PHP script.

NEWS
ext/standard/basic_functions.c
ext/standard/php_var.h
ext/standard/var.c

diff --git a/NEWS b/NEWS
index 18fe4d1a78ee2af49542368abf8eb08ada55d258..0588b8358ef9cbe7f333b2feb9d677a2b8c532d8 100644 (file)
--- 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
index 134b34c9269d8519d3d8e587724ee5afebd7d450..c0a0efcf090c18a479f44f62a9b6155d893f8b64 100644 (file)
@@ -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)
index 74f9bcb3d86d85c080ffc3cb8470c50d69bb70fb..42f1be5c2140837da22be5c4bb0c664a10782d28 100644 (file)
@@ -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);
index 5a8bb152fda657067336b5275e9d6059fa2a93af..db9fd604735f9d9eecf1e9b3a7d1b23ee6afc136 100644 (file)
@@ -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
 
 /*