Re: memory_get_usage with new Memory Manager

From: Date: Fri, 28 Jul 2006 09:42:41 +0000
Subject: Re: memory_get_usage with new Memory Manager
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-25034@lists.php.net to get a copy of this message
Hi all, For my own curiosity regarding the overhead with memory-limit or keeping track of usage so memory_get_[peak_]usage() can always be enabled, I just did some quick testing. Using this code PHP_FUNCTION(emalloc_tester) { int i; long mem_size; void *ptr; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mem_size) == FAILURE) { return; } for (i = 0; i < 100000; i++) { ptr = emalloc(mem_size); efree(ptr); } } with different mem_size's and timing it. Using the latest CVS files for 5.2; only difference is the --enable-memory-limit option. Dual 930MHz PIII Windows 2000 system (yes, *both* CPUs were maxed after mem_size got larger than would fit into a block :-)). -ms- Size On Off ------------------ 8 10.6 10.8 32 10.7 10.8 128 10.6 10.8 512 16.2 16.5 1k 16.3 16.5 8k 16.3 16.6 64k 16.3 16.6 128k 16.3 16.6 256k 2155 2140 512k 2225 2210 Interesting that it was consistently faster for me *with* memory-limit at the smaller sizes, which I assume are by far the most-used. Does this help at all? :-) Matt

« previous php.internals (#25034) next »