summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/basic_functions.c3
-rw-r--r--ext/standard/php_var.h3
-rw-r--r--ext/standard/var.c9
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