Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:6288 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73728 invoked by uid 1010); 8 Dec 2003 16:10:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 73704 invoked from network); 8 Dec 2003 16:10:23 -0000 Received: from unknown (HELO web13422.mail.yahoo.com) (216.136.175.132) by pb1.pair.com with SMTP; 8 Dec 2003 16:10:23 -0000 Message-ID: <20031208161022.13999.qmail@web13422.mail.yahoo.com> Received: from [24.215.130.244] by web13422.mail.yahoo.com via HTTP; Mon, 08 Dec 2003 08:10:22 PST Date: Mon, 8 Dec 2003 08:10:22 -0800 (PST) To: internals@lists.php.net MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-2050152583-1070899822=:11499" Subject: Should tsrm_shutdown() be calling resource_types_table dtors? From: msisolak@yahoo.com (Michael Sisolak) --0-2050152583-1070899822=:11499 Content-Type: text/plain; charset=us-ascii Content-Id: Content-Disposition: inline Following up on my question about the Win32 ISAPI/CLI not calling any of the destructor functions I've continued to dig into the TSRM code. I believe the issue is that tsrm_shutdown() doesn't call the destructors for each of the items in thread storage before freeeing them. This does happen in ts_free_thread(), but it looks like tsrm_shutdown() isn't accounting for a thread that hasn't had ts_free_thead() called on it before shutdown. I've attached a patch that I came up with that calls the dtors in tsrm_shutdown() just as they are in ts_free_thread() (i.e., first calling all destructors, and then freeing all items). This eliminates a huge pile of thread shutdown memory leaks for ISAPI and Win32 CLI. Is there a reason not to do this (i.e., I can't test non-Win32 builds so maybe there is a reason this isn't done this way)? Michael Sisolak msisolak@yahoo.com __________________________________ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ --0-2050152583-1070899822=:11499 Content-Type: text/plain; name="tsrm.c.diff" Content-Description: tsrm.c.diff Content-Disposition: inline; filename="tsrm.c.diff" --- tsrm.c.orig Mon Dec 08 11:00:27 2003 +++ tsrm.c Mon Dec 08 11:01:56 2003 @@ -157,7 +157,12 @@ int j; next_p = p->next; - for (j=0; jcount; j++) { + if (resource_types_table[j].dtor) { + resource_types_table[j].dtor(p->storage[j], &p->storage); + } + } + for (j=0; jcount; j++) { free(p->storage[j]); } free(p->storage); --0-2050152583-1070899822=:11499--