diff options
author | Andrey Hristov <andrey@php.net> | 2003-01-14 18:26:47 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2003-01-14 18:26:47 +0000 |
commit | 7866f02260bcab3c25ba76a0c7fd7af5cd6d5c35 (patch) | |
tree | 603190d96c608eed425fd76e906dffd5f336df23 | |
parent | 62f7e2714130efa8390128804166f3d482ced79b (diff) | |
download | php-git-7866f02260bcab3c25ba76a0c7fd7af5cd6d5c35.tar.gz |
added function get_memory_usage(). available only when PHP is compiled
with --enable-memory-limit
-rw-r--r-- | ext/standard/basic_functions.c | 3 | ||||
-rw-r--r-- | ext/standard/php_var.h | 3 | ||||
-rw-r--r-- | ext/standard/var.c | 9 |
3 files changed, 15 insertions, 0 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index bd90f3b287..68cf56964d 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -544,6 +544,9 @@ function_entry basic_functions[] = { PHP_FE(var_export, NULL) PHP_FE(debug_zval_dump, NULL) PHP_FE(print_r, NULL) +#if MEMORY_LIMIT + PHP_FE(get_memory_usage, NULL) +#endif PHP_FE(register_shutdown_function, NULL) PHP_FE(register_tick_function, NULL) diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h index 796e1a19e3..f399a236bf 100644 --- a/ext/standard/php_var.h +++ b/ext/standard/php_var.h @@ -28,6 +28,9 @@ PHP_FUNCTION(var_export); PHP_FUNCTION(debug_zval_dump); PHP_FUNCTION(serialize); PHP_FUNCTION(unserialize); +#if MEMORY_LIMIT +PHP_FUNCTION(get_memory_usage); +#endif void php_var_dump(zval **struc, int level TSRMLS_DC); void php_var_export(zval **struc, int level TSRMLS_DC); diff --git a/ext/standard/var.c b/ext/standard/var.c index 4b5c7dc5d8..e68a5a5400 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -677,6 +677,15 @@ PHP_FUNCTION(unserialize) /* }}} */ +#if MEMORY_LIMIT +/* {{{ proto int get_memory_usage() + Returns the allocated by PHP memory */ +PHP_FUNCTION(get_memory_usage) { + RETURN_LONG(AG(allocated_memory)); +} +/* }}} */ +#endif + /* * Local variables: * tab-width: 4 |