Re: [PHP-DEV] PHP 4.0 Bug #3347: string.c leaks memory From: Danny Heijl (Danny.Heijl <email protected>)
Date: 01/30/00

Andrei Zmievski wrote:
>
> Are you sure? I just did cvs update and compiled the latest version and
> it doesn't leak.
>

Reasonably sure :

current cvs (both zend & php4) :

<?php
$a = "abc def ghi";

$b = ucwords($a);

echo "ucwords:\n";
echo $a . "\n";
echo $b . "\n";

$a = "abc def ghi";

$b = ucfirst($a);

echo "ucfirst:\n";
echo $a . "\n";
echo $b . "\n";

$a = "abc def ghi";

$b = strtoupper($a);

echo "strtoupper:\n";
echo $a . "\n";
echo $b . "\n";

$a = "ABC DEF GHI";

$b = strtolower($a);

echo "strtolower:\n";
echo $a . "\n";
echo $b . "\n";

echo "chop:\n";
$a= "abc ";
$b= chop($a);

echo $a . "|\n";
echo $b . "|\n";

?>
  
X-Powered-By: PHP/4.0b4-dev
Content-Type: text/html

ucwords:
abc def ghi
Abc Def Ghi
ucfirst:
abc def ghi
Abc def ghi
strtoupper:
abc def ghi
ABC DEF GHI
strtolower:
ABC DEF GHI
abc def ghi
chop:
abc |
abc|
/home/web/php/php4/ext/standard/string.c(153) : Freeing 0x08245064 (4 bytes),
script=uc.php
../../php4/Zend/zend_execute.c(1537) : Freeing 0x0824502C (12 bytes),
script=uc.php
Last leak repeated 4 times
/home/web/php/php4/ext/standard/string.c(455) : Freeing 0x08244FF4 (12 bytes),
script=uc.php
../../php4/Zend/zend_variables.c(126) : Actual location (location was relayed)
/home/web/php/php4/ext/standard/string.c(422) : Freeing 0x08244F84 (12 bytes),
script=uc.php
../../php4/Zend/zend_variables.c(126) : Actual location (location was relayed)
/home/web/php/php4/ext/standard/string.c(1087) : Freeing 0x08244F14 (12 bytes),
script=uc.php
../../php4/Zend/zend_variables.c(126) : Actual location (location was relayed)
/home/web/php/php4/ext/standard/string.c(1109) : Freeing 0x0824AA74 (12 bytes),
script=uc.php
../../php4/Zend/zend_variables.c(126) : Actual location (location was relayed)

Danny

---

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>