|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-11-26 18:11 UTC] chregu@php.net
[2004-11-26 18:20 UTC] slaporte at eurocortex dot fr
[2004-11-26 18:29 UTC] slaporte at eurocortex dot fr
[2004-11-27 12:05 UTC] chregu@php.net
[2004-11-27 12:12 UTC] chregu@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
Description: ------------ Hello i'm using php and dom xml i encounter a memory leak the destructor of xpath context is not called i'm using 4_3_9 version i put some fprintf(stderr, ...) into the destructor and it never go inside the destructor was registered with "xpathcontext" le_xpathctxp = zend_register_list_destructors_ex(php_free_xpath_context, NULL, "xpathcontext", module_number); the class with "XPathContext" INIT_OVERLOADED_CLASS_ENTRY(ce, "XPathContext", php_xpathctx_class_functions, NULL, NULL, NULL); i try to make both lowercase but it is changing nothing the test script is very simple and when you run it and the process grow and grow and grow .... i add a function free to xpathcontext object that function calls the destructor then the memory is released but i would prefer that the destructor be called naturally Reproduce code: --------------- function StringToXml($sXml) { $oDom = domxml_open_mem($sXml); $oCtx = $oDom->xpath_new_context(); unset($oCtx); $oDom->free(); unset($oDom); } $s = getFile("test.xml"); for($n=200000; $n--;) { echo "$n<br/>"; flush(); StringToXml($s); } Expected result: ---------------- php process should not grow, memory should be released Actual result: -------------- php process grow