Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46115 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75818 invoked from network); 19 Nov 2009 22:52:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2009 22:52:33 -0000 X-Host-Fingerprint: 95.31.13.88 xdmitri2.static.corbina.ru Received: from [95.31.13.88] ([95.31.13.88:5725] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/A3-65535-03CC50B4 for ; Thu, 19 Nov 2009 17:52:33 -0500 Message-ID: <13.A3.65535.03CC50B4@pb1.pair.com> To: internals@lists.php.net References: Date: Fri, 20 Nov 2009 01:52:26 +0300 Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original X-Posted-By: 95.31.13.88 Subject: Re: clarification on maximum string sizes in PHP on 64 bit linux From: dmda@yandex.ru ("jvlad") > Code: > $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