diff options
| author | Zeev Suraski <zeev@php.net> | 1999-12-26 21:56:59 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 1999-12-26 21:56:59 +0000 |
| commit | aec33aa753de0f4dd6527bdc23c18710e0da4b83 (patch) | |
| tree | c301ee9dbdc8e1185e84c51da394fe3c0bd3af2d /Zend/zend_alloc.c | |
| parent | 14f915ece6854560742552aa0c5c714087b3f289 (diff) | |
| download | php-git-aec33aa753de0f4dd6527bdc23c18710e0da4b83.tar.gz | |
Introduce a zval-specific cache - 5-15% speed improvement
Diffstat (limited to 'Zend/zend_alloc.c')
| -rw-r--r-- | Zend/zend_alloc.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 7bcb8d1ef3..a47afae192 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -23,6 +23,7 @@ #include "zend.h" #include "zend_alloc.h" #include "zend_globals.h" +#include "zend_zval_alloc.h" #ifdef HAVE_SIGNAL_H # include <signal.h> #endif @@ -31,7 +32,7 @@ #endif #ifndef ZTS -static zend_alloc_globals alloc_globals; +zend_alloc_globals alloc_globals; #endif @@ -321,6 +322,10 @@ ZEND_API void start_memory_manager(ALS_D) AG(memory_exhausted)=0; #endif +#if ZEND_DEBUG + AG(zval_list_head) = NULL; +#endif + memset(AG(cache_count),0,MAX_CACHED_MEMORY*sizeof(unsigned char)); } @@ -330,9 +335,21 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache) zend_mem_header *p, *t; #if ZEND_DEBUG int had_leaks=0; +#else + zend_zval_list_entry *zval_list_entry, *next_zval_list_entry; #endif ALS_FETCH(); +#if !ZEND_DEBUG + zval_list_entry = AG(zval_list_head); + while (zval_list_entry) { + next_zval_list_entry = zval_list_entry->next; + efree(zval_list_entry); + zval_list_entry = next_zval_list_entry; + } + AG(zval_list_head) = NULL; +#endif + p=AG(head); t=AG(head); while (t) { |
