|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-06-03 05:07 UTC] tzikmund at iccc dot cz
[2002-06-03 05:10 UTC] mfischer@php.net
[2002-06-03 06:15 UTC] tzikmund at iccc dot cz
[2002-06-17 19:02 UTC] sniper@php.net
[2002-06-18 11:59 UTC] tzikmund at iccc dot cz
[2002-09-25 08:31 UTC] sniper@php.net
[2002-09-25 08:56 UTC] andrei@php.net
[2002-09-25 09:01 UTC] sander@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 07:00:01 2025 UTC |
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 the initialization of globals in standard regex extension. There's original module initialization taken from PHP 4.2.1 sources (ext/standard/reg.c): PHP_MINIT_FUNCTION(regex) { #ifdef ZTS ts_allocate_id(®_globals_id, sizeof(php_reg_globals), (ts_allocate_ctor) php_reg_init_globals, NULL); #else php_reg_init_globals(®_globals TSRMLS_CC); #endif return SUCCESS; } There's no destructor routine registered for the globals for thread-safe version of PHP. I've tried to correct it writing destructor routine, there's the modified source: static void php_reg_destroy_globals(php_reg_globals *reg_globals TSRMLS_DC) { zend_hash_destroy(®_globals->ht_rc); } PHP_MINIT_FUNCTION(regex) { #ifdef ZTS ts_allocate_id(®_globals_id, sizeof(php_reg_globals), (ts_allocate_ctor) php_reg_init_globals, (ts_allocate_dtor) php_reg_destroy_globals); #else php_reg_init_globals(®_globals TSRMLS_CC); #endif } I'm not sure if my modification is clean, but it seems to solve the leak problem.