> Code:
> <?php
> $s = str_repeat('A', pow(2,30));
> $t = $s.str_repeat('B', pow(2,30));; // fails with segfault
> printf("strlen: %u last-char: %s", strlen($s), substr($s, pow(2,30)-1));
> ?>
> ---
> Result:
> ./sapi/cli/php -d memory_limit=-1 a2.php
>
> Fatal error: Out of memory (allocated 2148270080) (tried to allocate
> 18446744071562067969 bytes) in /home/matt/tmp/php-src-5.2/a2.php on
> line 3
> ----

hmmm, 18446744071562067969 is 0xFFFFFFFF80000001
it seems a 32bit variable was used somewhere in the calculations and was 
assigned to a 64bit signed int.

what particular version of php did you use?
Did you try 5.3.1RC4? 5.2.12RC1?

I'd try myself if I had 4GB of RAM.

-jv 



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to