Bug #70078 [Ver]: Memleak when calling PHP functions from XSL with nodes as parameter

From: Date: Wed, 09 Sep 2015 17:58:51 +0000
Subject: Bug #70078 [Ver]: Memleak when calling PHP functions from XSL with nodes as parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195924@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70078&edit=1 ID: 70078 Updated by: cmb@php.net Reported by: mplomer at gmx dot de Summary: Memleak when calling PHP functions from XSL with nodes as parameter Status: Verified Type: Bug Package: XSLT related Operating System: any PHP Version: 5.6.11 Block user comment: N Private report: N New Comment: To clarify: there may not really be a memory *leak*, but at least the intermediate memory consumption is enormous: > Until 5.4.23 you have ~25 MB RAM usage of the process at the end > Starting with 5.4.24 you have ~1030 MB RAM usage of the process > at the end Previous Comments: ------------------------------------------------------------------------ [2015-09-09 16:29:26] mplomer at gmx dot de As described, I checked the process memory usage (under Windows in Task-Manager - should be the same with "ps" on unix) - memory_get_usage() does not cover this. I don't know what Valgrind checks exactly. And I don't know, which memory allocator libxml/libxslt uses. By the way you can also reproduce the problem by measuring the performance of transformToXML(), which is much much slower than with 5.4.23. Just tell me if you need more info. ------------------------------------------------------------------------ [2015-09-09 15:50:52] mike@php.net How did you confirm the memleak? Valgrind doesn't complain for me... ------------------------------------------------------------------------ [2015-07-15 20:57:01] mplomer at gmx dot de I also did not understand why exactly the xmlDocCopyNodeList() has been introduced here. IMHO passing nodes to a PHP function should never implicate such expensive recursive clones. ------------------------------------------------------------------------ [2015-07-15 20:38:43] cmb@php.net The memory leak (which I can confirm) might be caused by using xmlDocCopyNodeList() to create a new node list, which would have to be freed using xmlFreeNodeList() but is actually freed with xmlFreeNode(). However, I'm not able to reproduce the behavior described in #49634 with PHP 5.4.23, libxml2-2.7.4 and libxslt-1.1.25 (bug49634.phpt is passing there as well), so I can't go on here without the risk to reintroduce #49634. ------------------------------------------------------------------------ [2015-07-14 18:58:16] mplomer at gmx dot de Related To: Bug #49634 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=70078 -- Edit this bug report at https://bugs.php.net/bug.php?id=70078&edit=1

« previous php.bugs (#195924) next »