ID: 47669 Updated by: j...@php.net Reported By: vGhost2000 at gmail dot com -Status: Open +Status: Bogus Bug Type: ICONV related Operating System: Linux 2.6.24-23-xen SMP x86_64 -PHP Version: 5.2.9 +PHP Version: 5.2.4 New Comment:
Thank you for taking the time to report a problem with PHP. Unfortunately you are not using a current version of PHP -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. Previous Comments: ------------------------------------------------------------------------ [2009-03-16 07:02:54] vGhost2000 at gmail dot com Description: ------------ When "Iconv" and "Multibyte String" library classes operate on "SimpleXML" object a memory leak occures while processing "SimpleXML" string objects. If "SimpleXML" string object is converted into an "ordinal" string before the control is being passed to routines from "Iconv" and "Multibyte String" libraries the memory leak doesn't occur. ---------- System Linux 2.6.24-23-xen #1 SMP Mon Jan 26 03:09:12 UTC 2009 x86_64 Apache Version Apache/2.2.8 (Ubuntu) PHP Version 5.2.4-2ubuntu5.5 with Suhosin-Patch Server API Apache 2.0 Handler Zend Engine v2.2.0 phpinfo(): http://79.170.152.11/phpinf.php Reproduce code: --------------- <?php mb_Internal_Encoding('UTF-8'); Header('Content-Type: text/plain; charset=UTF-8'); $sxml = SimpleXML_Load_String('<main><el>some string</el></main>'); For($i = 0; $i < 1000; $i++) { $tmp = IConv('UTF-8', 'UTF-8//TRANSLIT', $sxml->el); # v1 //$tmp = mb_StrToLower($sxml->el); # v2 //$tmp = IConv('UTF-8', 'UTF-8//TRANSLIT', (string)$sxml->el); # v3 //$tmp = mb_StrToLower((string)$sxml->el); # v4 UnSet($tmp); If(!($i % 100)) { Echo $i . ' - ' . Number_Format(Memory_Get_Usage()) . "\n"; } } ?> Expected result: ---------------- In example the first and the second variants demonstrate memory leak. The third and the fourth variants show that some extra conversions help to avoid the memory leak. The results of the script execution. v1: 0 - 103,352 100 - 185,816 200 - 268,232 300 - 350,632 400 - 433,032 500 - 515,432 600 - 646,984 700 - 729,384 800 - 811,800 900 - 894,200 v2: 0 - 103,080 100 - 185,584 200 - 268,016 300 - 350,416 400 - 432,816 500 - 515,216 600 - 646,800 700 - 729,200 800 - 811,600 900 - 894,000 v3: 0 - 103,400 100 - 103,456 200 - 103,456 300 - 103,456 400 - 103,456 500 - 103,456 600 - 103,456 700 - 103,456 800 - 103,456 900 - 103,456 v4: 0 - 103,128 100 - 103,184 200 - 103,184 300 - 103,184 400 - 103,184 500 - 103,184 600 - 103,184 700 - 103,184 800 - 103,184 900 - 103,184 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47669&edit=1