Edit report at https://bugs.php.net/bug.php?id=62684&edit=1
ID: 62684 User updated by: jerico dot dev at gmail dot com Reported by: jerico dot dev at gmail dot com Summary: PHP/DOMDocument: unset() does not release resources -Status: Open +Status: Closed Type: Bug Package: Performance problem Operating System: Linux PHP Version: 5.3.15 Block user comment: N Private report: N New Comment: I could track this down to a memory leak unrelated to DOMDocument. I'm still far from isolating the problem. But it's not what I thought. Sorry for the noise. Previous Comments: ------------------------------------------------------------------------ [2012-07-28 18:54:39] jerico dot dev at gmail dot com The link is not meant as a reproduction script but points to the actual source code + solutions I've tried. I tried a long time to better isolate the problem but I couldn't reproduce it in a smaller setting. I appreciate any hint how I could go about further isolating the problem. I currently only rely on memory_get_usage() and xdebug_debug_zval(). Is there anything more I could do to identify what actually causes the problem? Does PHP provide some internal debugging messages that might indicate why unset() could not release the memory? Here's what I already tried out: * I checked that the reference count of $dom is exactly one immediately before the call to unset(): xdebug_debug_zval('dom') reports: dom: (refcount=1, is_ref=0)=class DOMDocument { }. * I tried gc_enable() + gc_collect_cycles(). * I tried the solution proposed in http://stackoverflow.com/questions/8379829/domdocument-php-memory-leak * I tried calling $dom->__destruct() before unset() but this will result in an error as DOMDocument apparently does not have a destructor. * I recursively removed all nodes in the DOM before I unset the variable. It did not make the least difference. * I tried setting the variable to null before re-using it: $dom = null None of these showed any effect. I'm simply out of ideas how to simulate the problem in a way that makes it easier for you to reproduce it. ------------------------------------------------------------------------ [2012-07-28 18:30:42] ras...@php.net Sorry, a 1126-line reproduce script? I doubt any of us are going to read through that. Please simplify to a 10-15 line example that shows the problem you are having. ------------------------------------------------------------------------ [2012-07-28 18:01:01] jerico dot dev at gmail dot com Description: ------------ A complete problem description + sample code can be found here: http://stackoverflow.com/questions/11703164/php-domdocument-unset-does-not-release-resources Test script: --------------- https://github.com/jerico-dev/ojs/blob/abc2af0f66c11664b7e917201fd707aa3307a1e0/plugins/generic/lucene/classes/SolrWebService.inc.php#L296 Expected result: ---------------- I expect unset() to release the memory resources that were used for the object. Actual result: -------------- unset() only releases a tiny amount of the resources actually used. See the debug output in http://stackoverflow.com/questions/11703164/php-domdocument-unset-does-not-release-resources ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62684&edit=1