From ffcd9cccf573e83d9d1b7d3e9040d5e488a58887 Mon Sep 17 00:00:00 2001 From: Xuefer Date: Fri, 13 Dec 2013 07:39:33 +0000 Subject: [PATCH] MFT, fixed #333: reduce memory usage for small or empty files git-svn-id: svn://svn.lighttpd.net/xcache/branches/3.2@1480 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- ChangeLog | 6 ++++++ NEWS | 4 ++++ mod_cacher/xc_cacher.c | 6 ------ processor/processor.m4 | 14 ++++++++------ 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20d4858..1528277 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +3.2.0 2013-??-?? +ChangeLog +======== + * cacher: + * fixed #333: reduce memory usage for small or empty files + 3.1.1 2013-??-?? ChangeLog ======== diff --git a/NEWS b/NEWS index 51d9dda..f4420e8 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,8 @@ +3.2.1 2013-??-?? +======== + 3.1.1 2013-??-?? +======== * compatible with bcompiler 3.1.0 2013-10-10 diff --git a/mod_cacher/xc_cacher.c b/mod_cacher/xc_cacher.c index 242c6af..a5434dc 100644 --- a/mod_cacher/xc_cacher.c +++ b/mod_cacher/xc_cacher.c @@ -825,11 +825,6 @@ static zend_op_array *xc_entry_install(xc_entry_php_t *entry_php TSRMLS_DC) /* { CG(zend_lineno) = 0; #endif - i = 1; -#ifndef ZEND_ENGINE_2_2 - zend_hash_add(&EG(included_files), entry_php->entry.name.str.val, entry_php->entry.name.str.len+1, (void *)&i, sizeof(int), NULL); -#endif - #ifndef ZEND_ENGINE_2 xc_free_alloca(new_cest_ptrs, use_heap); #endif @@ -2146,7 +2141,6 @@ static zend_op_array *xc_compile_file_cached(xc_compiler_t *compiler, zend_file_ /* found entry */ if (stored_entry && stored_php) { - zend_llist_add_element(&CG(open_files), h); return xc_compile_restore(stored_entry, stored_php TSRMLS_CC); } diff --git a/processor/processor.m4 b/processor/processor.m4 index 835c6a1..075287e 100644 --- a/processor/processor.m4 +++ b/processor/processor.m4 @@ -750,22 +750,24 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ /* deep */ STRUCT_P(HashTable, static_variables, HashTable_zval_ptr) #ifdef ZEND_ENGINE_2 - STRUCT_ARRAY(zend_uint, num_args, zend_arg_info, arg_info) - gc_arg_info = 1; + if (SRC(`arg_info')) { + gc_arg_info = 1; + STRUCT_ARRAY(zend_uint, num_args, zend_arg_info, arg_info) + } #endif DST(`filename') = processor->entry_php_src->filepath; + #ifdef ZEND_ENGINE_2_4 - if (SRC(`literals')) { + if (SRC(`literals') && op_array_info->literalinfo_cnt) { gc_opcodes = 1; - if (op_array_info->literalinfo_cnt) { - gc_literals = 1; - } + gc_literals = 1; } #else if (op_array_info->oplineinfo_cnt) { gc_opcodes = 1; } #endif + #ifdef ZEND_ENGINE_2_4 if (gc_literals) { dnl used when copying opcodes