note 101155 added to function.memory-get-usage

From: Date: Tue, 30 Nov 2010 10:45:36 +0000
Subject: note 101155 added to function.memory-get-usage
Groups: php.notes 
Request: Send a blank email to php-notes+get-174467@lists.php.net to get a copy of this message
It is claimed that this function calls the PHP memory garbage collector by some of the commenters. A quick check of the source code (PHP 5.2.9) shows that this function does not do any garbage collection. From var.c: ZEND_API size_t zend_memory_usage(int real_usage TSRMLS_DC) { if (real_usage) { return AG(mm_heap)->real_size; } else { #if MEMORY_LIMIT return AG(mm_heap)->size; #else return AG(mm_heap)->real_size; #endif } } And from zend_alloc.c /* {{{ proto int memory_get_usage([real_usage]) Returns the allocated by PHP memory */ PHP_FUNCTION(memory_get_usage) { zend_bool real_usage = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &real_usage) == FAILURE) { RETURN_FALSE; } RETURN_LONG(zend_memory_usage(real_usage TSRMLS_CC)); } /* }}} */ ---- Server IP: 69.147.83.197 Probable Submitter: 58.27.115.118 ---- Manual Page -- http://www.php.net/manual/en/function.memory-get-usage.php Edit -- https://master.php.net/note/edit/101155 Del: integrated -- https://master.php.net/note/delete/101155/integrated Del: useless -- https://master.php.net/note/delete/101155/useless Del: bad code -- https://master.php.net/note/delete/101155/bad+code Del: spam -- https://master.php.net/note/delete/101155/spam Del: non-english -- https://master.php.net/note/delete/101155/non-english Del: in docs -- https://master.php.net/note/delete/101155/in+docs Del: other reasons-- https://master.php.net/note/delete/101155 Reject -- https://master.php.net/note/reject/101155 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174467) next »