php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11739 Memory limit is used for all scripts instead of one script?
Submitted: 2001-06-27 10:43 UTC Modified: 2002-01-02 13:57 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: swift at fanpro dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.6 OS: Suse Linux 7.0
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: swift at fanpro dot com
New email:
PHP Version: OS:

 

 [2001-06-27 10:43 UTC] swift at fanpro dot com
Hi there!

As far as I understand, the option "memory_limit" sets the mem-limit for ONE script.
I installed PHP as a Apache module and I set the memory_limit to 16M (via php.ini).

When I allocate 8M of memory, all works fine. But when two different scripts each allocate 8M, I will get sometimes the following message:
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 4194304 bytes) in /usr/local/httpd/htdocs/testxx.php on line 6

Both scripts (testx.php and testxx.php) contain the following code:
<?php

  $str = "x";
  for($i=0; $i<23; $i++)
  {
    $str .= $str;
    echo strlen($str) . "<br>";
  }
?>

First, 1 byte will be allocated, then 2, then 4 and so on. The last allocated string has a size of 8M.
It's a little difficult to reproduce the problem because I have to call both scripts exactly at the same time from my browser. But, as I said, sometimes I get the described error-message.

My question is: Is this normal and memory_limit sets the limit for ALL scripts that are currently running or is this a bug?

Thanks in advance!

 ... tobias wiersch from germany

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-12 08:45 UTC] yohgaki@php.net
This is similar to set_time_limit() problem... 
Anyone know if this is fixed or not?

To reporter: Could you try 4.1.0 and report the result?
 [2002-01-02 13:57 UTC] lobbin@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 08:01:27 2025 UTC