andrey Thu Feb 6 09:34:08 2003 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/standard php_var.h var.c basic_functions.c
Log:
Backporting memory_get_usage() from HEAD.
As far as the code is small there won't be any problems.
Index: php4/ext/standard/php_var.h
diff -u php4/ext/standard/php_var.h:1.21.4.1 php4/ext/standard/php_var.h:1.21.4.2
--- php4/ext/standard/php_var.h:1.21.4.1 Tue Dec 31 11:35:33 2002
+++ php4/ext/standard/php_var.h Thu Feb 6 09:34:07 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_var.h,v 1.21.4.1 2002/12/31 16:35:33 sebastian Exp $ */
+/* $Id: php_var.h,v 1.21.4.2 2003/02/06 14:34:07 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(memory_get_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.150.2.2 php4/ext/standard/var.c:1.150.2.3
--- php4/ext/standard/var.c:1.150.2.2 Tue Dec 31 11:35:35 2002
+++ php4/ext/standard/var.c Thu Feb 6 09:34:07 2003
@@ -679,6 +679,15 @@
/* }}} */
+#if MEMORY_LIMIT
+/* {{{ proto int memory_get_usage()
+ Returns the allocated by PHP memory */
+PHP_FUNCTION(memory_get_usage) {
+ RETURN_LONG(AG(allocated_memory));
+}
+/* }}} */
+#endif
+
/*
* Local variables:
* tab-width: 4
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.543.2.6
php4/ext/standard/basic_functions.c:1.543.2.7
--- php4/ext/standard/basic_functions.c:1.543.2.6 Tue Jan 28 18:46:13 2003
+++ php4/ext/standard/basic_functions.c Thu Feb 6 09:34:07 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.543.2.6 2003/01/28 23:46:13 phanto Exp $ */
+/* $Id: basic_functions.c,v 1.543.2.7 2003/02/06 14:34:07 andrey Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -545,6 +545,9 @@
PHP_FE(call_user_method_array, second_arg_force_ref)
PHP_FE(serialize,
NULL)
PHP_FE(unserialize,
NULL)
+#if MEMORY_LIMIT
+ PHP_FE(memory_get_usage,
+ NULL)
+#endif
PHP_FE(var_dump,
NULL)
PHP_FE(var_export,
NULL)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php