# Why zend_shutdown_constants not called from executor_globals_dtor?

- Thread: https://externals.io/message/12734
- Original archive: https://news-web.php.net/php.internals/12734
- Started by Kamesh Jayachandran on 2004-09-11T11:38:15+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

---

## #12734 — Kamesh Jayachandran — 2004-09-11T11:38:15+00:00

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

Hi All,
I could see in executor_globals_ctor calling zend_startup_constants
which allocates one hash table.
Later to free this hash table zend_shutdown_constants is called from
zend_shutdown rather than executor_globals_dtor.
This may not cause a memory leak in Non ZTS environment where
zend_shutdown and executor_globals_dtor are called only once and the
current free up by calling zend_shutdown_constants from zend_shutdown
won't cause any memory leak.

In case of ZTS environment every thread calls executor_globals_ctor and
only the main thread causes zend_shutdown and hence only main thread
EG(zend_constants) are freed whereas other threads EG(zend_constants)
are not freed.

Correct me if I am wrong.

With regards
Kamesh Jayachandran
