ID: 37114 Updated by: [EMAIL PROTECTED] Reported By: virtuall at virtuall dot info -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux, Freebsd PHP Version: 5.1.2 New Comment:
If you make a larger loop you will see it stops increasing at some point. Please, leave this matter closed as there is no bug. Previous Comments: ------------------------------------------------------------------------ [2006-04-18 08:26:25] virtuall at virtuall dot info Hmm... indeed in this example it happens only once, but it did leak in my daemon, so I tried to reproduce that code. And it looks like it happens only when there are 8 or more separators in the string: <?php echo memory_get_usage(), "\n"; for ($i = 0; $i < 20; ++$i) { explode('.', '........'); echo memory_get_usage(), "\n"; } ?> and there it goes... 41008 41816 41880 41944 42008 ... try that with 7 dots and it will work fine! 41016 41704 41704 41704 ... don't say it isn't a bug either ------------------------------------------------------------------------ [2006-04-18 07:54:50] [EMAIL PROTECTED] This is not a bug... PHP caches some internal things. If you run this script you'll see it only "leaks" once... but it's just a cached allocation: <?php echo memory_get_usage(), "\n"; for ($i = 0; $i < 100; ++$i) { explode(' ', 'blah foo bar'); echo memory_get_usage(), "\n"; } ?> ------------------------------------------------------------------------ [2006-04-18 07:51:05] virtuall at virtuall dot info Exactly, memory is freed in the end of script, but there is no way to free it in the runtime - and it's a disaster for highly loaded daemons (yes, I write daemons in PHP). Or are you trying to tell me it's not a bug? ------------------------------------------------------------------------ [2006-04-17 22:56:05] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Memory gets freed at the end the script. ------------------------------------------------------------------------ [2006-04-17 21:23:39] virtuall at virtuall dot info Description: ------------ It's a strange that nobody has noticed a memleak in such an essential function. This needs no comments, does it? Reproduce code: --------------- <?php echo memory_get_usage() . "\n"; explode(' ', 'blah foo bar'); echo memory_get_usage() . "\n"; ?> Expected result: ---------------- 40824 40824 Actual result: -------------- 40824 41120 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37114&edit=1