Bug #17571: Memory leak in basic globals
| From: | tzikmund at iccc dot cz | Date: | Mon, 03 Jun 2002 09:19:00 +0000 |
| Subject: | Bug #17571: Memory leak in basic globals | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-9282@lists.php.net to get a copy of this message | ||
From: tzikmund@iccc.cz
Operating system: Redhat Linux 7.2
PHP version: 4.2.1
PHP Bug Type: *General Issues
Bug description: Memory leak in basic globals
I'm trying to run PHP in my own multithreaded environment.
Memory leaks are critical for my application.
I've tried to track the leaks down using memprof and I think
I've found a leak in basic globals destructor:
There's original basic globals destructor source
from PHP 4.2.1:
static void basic_globals_dtor(php_basic_globals *basic_globals_p
TSRMLS_DC)
{
zend_hash_destroy(&BG(sm_protected_env_vars));
if (BG(sm_allowed_env_vars)) {
free(BG(sm_allowed_env_vars));
}
#ifdef PHP_WIN32
CoUninitialize();
#endif
}
There's an item called url_adapt_state_ex in the BG array which seems to
be no deallocated in the destructor.
I've tried following modification:
static void basic_globals_dtor(php_basic_globals *basic_globals_p
TSRMLS_DC)
{
zend_hash_destroy(&BG(sm_protected_env_vars));
if (BG(sm_allowed_env_vars)) {
free(BG(sm_allowed_env_vars));
}
if (BG(url_adapt_state_ex).tags)
{
zend_hash_destroy(BG(url_adapt_state_ex).tags);
free(BG(url_adapt_state_ex).tags);
}
#ifdef PHP_WIN32
CoUninitialize();
#endif
}
I don't know if my modification is clean, but it seems to solve the
problem.
--
Edit bug report at http://bugs.php.net/?id=17571&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17571&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17571&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17571&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17571&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17571&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17571&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17571&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17571&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17571&r=globals