From: Zeev Suraski Date: Tue, 16 May 2000 15:42:16 +0000 (+0000) Subject: - Small optimization. Filling up the Cache helps performance. X-Git-Tag: php-4.0.0~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac0e07ecdaa1ecda91de17784d0e0348c105c435;p=php - Small optimization. Filling up the Cache helps performance. --- diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index d9602c3f69..2b1034eab1 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -319,6 +319,9 @@ ZEND_API int zend_set_memory_limit(unsigned int memory_limit) ZEND_API void start_memory_manager(ALS_D) { + int i, j; + void *cached_entries[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES]; + AG(phead) = AG(head) = NULL; #if MEMORY_LIMIT @@ -334,6 +337,18 @@ ZEND_API void start_memory_manager(ALS_D) memset(AG(fast_cache_list_head), 0, sizeof(AG(fast_cache_list_head))); memset(AG(cache_count),0,MAX_CACHED_MEMORY*sizeof(unsigned char)); + + /* Initialize cache, to prevent fragmentation */ + for (i=1; i