]> granicus.if.org Git - php/commitdiff
added function get_memory_usage(). available only when PHP is compiled
authorAndrey Hristov <andrey@php.net>
Tue, 14 Jan 2003 18:26:47 +0000 (18:26 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 14 Jan 2003 18:26:47 +0000 (18:26 +0000)
with --enable-memory-limit

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

index bd90f3b2879f7da5ebcffeb80c4faf6e33386e86..68cf56964dfc9d5885af580ad0363677269f73c2 100644 (file)
@@ -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)
index 796e1a19e338d748e51456c16d8d784f5598c0d1..f399a236bfe268da46827924fb94cf230d58c850 100644 (file)
@@ -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);
index 4b5c7dc5d854e62c4f91617784fe85ce17f2e620..e68a5a54005f0e94b6ec8e17d50984cf273ff905 100644 (file)
@@ -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