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
[EMAIL PROTECTED]
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--- 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; j<id_count; j++) {
+ for (j=0; j<p->count; j++) {
+ if (resource_types_table[j].dtor) {
+
resource_types_table[j].dtor(p->storage[j], &p->storage);
+ }
+ }
+ for (j=0; j<p->count; j++) {
free(p->storage[j]);
}
free(p->storage);
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php