|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-07-28 18:01 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 18:00:01 2025 UTC |
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.