From ac0e07ecdaa1ecda91de17784d0e0348c105c435 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Tue, 16 May 2000 15:42:16 +0000 Subject: [PATCH] - Small optimization. Filling up the Cache helps performance. --- Zend/zend_alloc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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