|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45296 some string funcs need unexpectedly high memory_limit
Submitted: 2008-06-18 09:12 UTC Modified: 2008-10-29 03:22 UTC
From: louis at steelbytes dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 5.2.6 OS: windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: louis at steelbytes dot com
New email:
PHP Version: OS:


 [2008-06-18 09:12 UTC] louis at steelbytes dot com
the following code fails with 

  Fatal error: Allowed memory size of 587896 bytes exhausted (tried to allocate 262145 bytes)

  php.exe -n -f memuse.php

  $big = str_repeat('x',big_size);

yet if I change big_size to 1024*1024, then it works?

and a simlar script
  echo str_repeat('x',big_size);

also fails, yet if I change big_size to 180*1024 then it works?

PS, note that in the first script I set mem limit to 2 times big_size, and in the 2nd script I did not.

Reproduce code:
see above

Expected result:
see above

Actual result:
see above


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-28 13:26 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

 [2008-10-29 03:22 UTC] louis at steelbytes dot com
> but this is not a bug

what is it then?

why can't I use memory_get_usage() + ini_set('memory_limit',xxx) to check for memory leaks in my code?

do I just give up and ini_set('memory_limit',4GigaBytes) and never give a damn about memeory?
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 12:01:30 2024 UTC