Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:468 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71499 invoked from network); 29 Mar 2003 14:13:17 -0000 Received: from unknown (HELO mail.digarc.com) (216.204.113.51) by pb1.pair.com with SMTP; 29 Mar 2003 14:13:17 -0000 Received: from ctd01 (dsta-aa203.pivot.net [66.186.171.203]) by mail.digarc.com (8.11.6/8.11.2) with SMTP id h2TFvME29646 for ; Sat, 29 Mar 2003 10:57:22 -0500 Message-ID: <017801c2f5fd$f9009090$06dea8c0@cyberware.local> To: "php-dev" References: <1048001497.1516.3.camel@localhost.localdomain> <001901c2ed6f$b3be6f70$0301a8c0@TRABAJOS2> <016701c2f156$f6d83080$06dea8c0@cyberware.local> <006d01c2f5de$d5d42470$06dea8c0@cyberware.local> Date: Sat, 29 Mar 2003 09:17:46 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Subject: ZE module shutdown From: rrichards@digarc.com ("Rob Richards") When an extension is loaded from a script rather than the ini file, the resources are being destroyed incorrectly. When I change zend_list and zend_hash to the following, the resources are now destroyed in the same order as they are when the extension is loaded from the ini file and no more memory issues (tested under windows). It seems zend_clean_module_rsrc_dtors should be changed to something along the lines of: zend_list.c void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC) { zend_hash_apply_reverse_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC); } zend_hash.c ZEND_API void zend_hash_apply_reverse_with_argument(HashTable *ht, apply_func_arg_t apply_func, void *argument TSRMLS_DC) { Bucket *p; IS_CONSISTENT(ht); HASH_PROTECT_RECURSION(ht); p = ht->pListTail; while (p != NULL) { if (apply_func(p->pData, argument TSRMLS_CC)) { p = zend_hash_apply_deleter(ht, p); } else { p = ht->pListTail; } } HASH_UNPROTECT_RECURSION(ht); } does this seem to be correct? Basically the only change is that it traverses the hash table in reverse. didnt make a diff as not sure wether this is correct logic or if there is a functions already there which would do the same aszend_hash_apply_reverse_with_argument. Thanks, Rob