# Should tsrm_shutdown() be calling resource_types_table dtors?

- Thread: https://externals.io/message/6288
- Original archive: https://news-web.php.net/php.internals/6288
- Started by Michael Sisolak on 2003-12-08T16:10:22+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #6288 — Michael Sisolak — 2003-12-08T16:10:22+00:00

URL: https://externals.io/message/6288#6288

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/
