This should follow our naming conventions and be called memory_get_usage().

Andi

At 06:26 PM 1/14/2003 +0000, Andrey Hristov wrote:
andrey Tue Jan 14 13:26:47 2003 EDT

Modified files:
/php4/ext/standard basic_functions.c php_var.h var.c
Log:
added function get_memory_usage(). available only when PHP is compiled
with --enable-memory-limit


Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.559 php4/ext/standard/basic_functions.c:1.560
--- php4/ext/standard/basic_functions.c:1.559 Mon Jan 13 13:12:23 2003
+++ php4/ext/standard/basic_functions.c Tue Jan 14 13:26:47 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: basic_functions.c,v 1.559 2003/01/13 18:12:23 andrey Exp $ */
+/* $Id: basic_functions.c,v 1.560 2003/01/14 18:26:47 andrey Exp $ */

#include "php.h"
#include "php_streams.h"
@@ -544,6 +544,9 @@
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: php4/ext/standard/php_var.h
diff -u php4/ext/standard/php_var.h:1.22 php4/ext/standard/php_var.h:1.23
--- php4/ext/standard/php_var.h:1.22 Tue Dec 31 11:07:54 2002
+++ php4/ext/standard/php_var.h Tue Jan 14 13:26:47 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: php_var.h,v 1.22 2002/12/31 16:07:54 sebastian Exp $ */
+/* $Id: php_var.h,v 1.23 2003/01/14 18:26:47 andrey Exp $ */

#ifndef PHP_VAR_H
#define PHP_VAR_H
@@ -28,6 +28,9 @@
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: php4/ext/standard/var.c
diff -u php4/ext/standard/var.c:1.153 php4/ext/standard/var.c:1.154
--- php4/ext/standard/var.c:1.153 Sun Jan 12 08:50:17 2003
+++ php4/ext/standard/var.c Tue Jan 14 13:26:47 2003
@@ -677,6 +677,15 @@

/* }}} */

+#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



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to