Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend.c
| From: | Andi Gutmans | Date: | Sat, 10 Sep 2005 22:23:30 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend.c | ||
| References: | 1 2 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-4110@lists.php.net to get a copy of this message | ||
Nope. We'll also patch 5.1 and then when we're sure it's stable we can consider patching other versions.
Note that this would rarely affect someone in a real production setting....
Andi
At 01:48 PM 9/10/2005, Jani Taskinen wrote:
Do these leaks only exist in HEAD?--JaniOn Fri, 9 Sep 2005, Dmitry Stogov wrote:-- Donate @ http://pecl.php.net/wishlist.php/sniper -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpdmitry Fri Sep 9 04:19:58 2005 EDTModified files: /ZendEngine2 zend.c Log: Fixed huge memory leaks in ZTS mode http://cvs.php.net/diff.php/ZendEngine2/zend.c?r1=1.321&r2=1.322&ty=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.321 ZendEngine2/zend.c:1.322--- ZendEngine2/zend.c:1.321 Thu Sep 8 12:15:16 2005+++ ZendEngine2/zend.c Fri Sep 9 04:19:56 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.321 2005/09/08 16:15:16 dmitry Exp $ */ +/* $Id: zend.c,v 1.322 2005/09/09 08:19:56 dmitry Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -221,6 +221,7 @@ static HashTable *global_u_class_table = NULL; static HashTable *global_u_constants_table = NULL; static HashTable *global_u_auto_globals_table = NULL; +static HashTable *global_persistent_list = NULL; ZEND_API zend_utility_values zend_uv; @@ -1097,6 +1098,20 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC) {zend_ini_shutdown(TSRMLS_C); + if (&executor_globals->persistent_list != global_persistent_list) { + zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC); + } + if (executor_globals->global_constants_table != global_constants_table && + executor_globals->global_u_constants_table != global_u_function_table) { + if (executor_globals->global_constants_table) { + zend_hash_destroy(executor_globals->global_constants_table); + free(executor_globals->global_constants_table); + } + if (executor_globals->global_u_constants_table) { + zend_hash_destroy(executor_globals->global_u_constants_table); + free(executor_globals->global_u_constants_table); + } + }} @@ -1296,6 +1311,7 @@ #ifndef ZTSzend_init_rsrc_plist(TSRMLS_C); + global_persistent_list = &EG(persistent_list);#endifif (start_builtin_functions) {@@ -1370,6 +1386,7 @@compiler_globals_ctor(compiler_globals, tsrm_ls); free(EG(zend_constants)); executor_globals_ctor(executor_globals, tsrm_ls); + global_persistent_list = &EG(persistent_list); zend_new_thread_end_handler(tsrm_thread_id() TSRMLS_CC);#endif } @@ -1380,9 +1397,6 @@ #ifdef ZEND_WIN32zend_shutdown_timeout_thread();#endif -#ifndef ZTS- zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);-#endifzend_hash_graceful_reverse_destroy(&module_registry);zend_hash_destroy(global_function_table);@@ -1404,16 +1418,6 @@zend_shutdown_extensions(TSRMLS_C); free(zend_version_info);-#ifdef ZTS- if (EG(global_constants_table)) { - zend_hash_destroy(EG(global_constants_table)); - free(EG(global_constants_table)); - } - if (EG(global_u_constants_table)) { - zend_hash_destroy(EG(global_u_constants_table)); - free(EG(global_u_constants_table)); - }-#endifzend_hash_destroy(global_constants_table); free(global_constants_table); if (global_u_constants_table) {@@ -1429,11 +1433,18 @@if (global_u_class_table) { free(global_u_class_table); } + if (global_persistent_list) { + zend_destroy_rsrc_list(global_persistent_list TSRMLS_CC); + }#ifdef ZTS- zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); global_function_table = NULL; + global_u_function_table = NULL; global_class_table = NULL; + global_u_class_table = NULL; global_auto_globals_table = NULL; + global_u_auto_globals_table = NULL; + global_constants_table = NULL; + global_u_constants_table = NULL;#elseunicode_globals_dtor(&unicode_globals TSRMLS_CC);#endif