php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32318 memory_limit does not work
Submitted: 2005-03-15 17:33 UTC Modified: 2005-03-19 23:37 UTC
From: camka at email dot ee Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.10 OS: Linux
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: camka at email dot ee
New email:
PHP Version: OS:

 

 [2005-03-15 17:33 UTC] camka at email dot ee
Description:
------------
php compiled with --enable-memory-limit, but setting the value of memory_limit more then certain number won't affect scripts.

tried set the value of memory_limit in both php.ini and script body - nothing helped.

Reproduce code:
---------------
<?php
    echo ini_get('memory_limit'),"\n";
    ini_set('memory_limit', 100000000);
    echo ini_get('memory_limit'),"\n";
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
    function a()
    {
        echo 'fck oyu!';
    }
    register_shutdown_function('a');
    $zz = 'u';
    for($i=1; $i<1000; $i++)
    {
        $zz .= $zz;
        echo $i,' - ',  memory_get_usage(),"<br>\n";flush();
    }

?>


Expected result:
----------------
allocate at least 100MB of memory and die if exceeded.

Actual result:
--------------
100M
100000000
1 - 12912<br>
2 - 12912<br>
3 - 12920<br>
4 - 12944<br>
5 - 12960<br>
6 - 13032<br>
7 - 13096<br>
8 - 13224<br>
9 - 13480<br>
10 - 13992<br>
11 - 15016<br>
12 - 17064<br>
13 - 21160<br>
14 - 29352<br>
15 - 45736<br>
16 - 78504<br>
17 - 144040<br>
18 - 275112<br>
19 - 537256<br>
20 - 1061544<br>
21 - 2110120<br>
22 - 4207272<br>
23 - 8401576<br>


error_log:
FATAL:  erealloc():  Unable to allocate 16777217 bytes

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-15 23:56 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

This works fine here..

 [2005-03-16 23:20 UTC] camka at email dot ee
No. Last snapshot didn't help either. The situation is the same. On other servers code works allrigh though. What could be the clue here?
 [2005-03-17 09:44 UTC] sniper@php.net
Broken GCC or some other tool in that system.
No PHP bug if it works elsewhere..

 [2005-03-17 17:35 UTC] camka at email dot ee
the apache was configured as:

'./configure' '--bindir=/usr/bin' '--mandir=/usr/share/man' '--with-apache=../apache_1.3.33' '--with-config-file-path=/etc/apache' '--with-gnu-ld' '--without-pear' '--enable-track-vars' '--enable-memory-limit' '--enable-short-tags' '--enable-inline-optimization' '--disable-display-source' '--disable-url-fopen-wrapper' '--disable-cli' '--disable-posix' '--with-pcre-regex' '--disable-ctype' '--disable-overload' '--disable-tokenizer' '--disable-ipv6' '--disable-simplexml' '--without-sqlite' '--with-mysql=/usr' '--disable-session' '--enable-sockets' '--without-zlib' '--with-iconv' '--enable-mbstring=all' '--enable-mbregex'

software versions:
- fedora-release-2-4
- gcc-3.3.3-7
- binutils-2.15.90.0.3-5

perhaps any other information to provide?
 [2005-03-19 23:37 UTC] camka at email dot ee
sorry. I wrote that the error occurres only on one computer. It appeared to be wrong. It goes up on several servers with similar configuration i described in previous post.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 01:01:28 2024 UTC