php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60062 Negative memory (allocated -1119879168)
Submitted: 2011-10-14 12:02 UTC Modified: 2011-11-16 00:44 UTC
Votes:2
Avg. Score:1.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: septerrianin at mail dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.8 OS: Debian GNU/Linux
Private report: No CVE-ID: None
 [2011-10-14 12:02 UTC] septerrianin at mail dot ru
Description:
------------
Sample error on system with 4+ Gbyte memory:

Fatal error: Out of memory (allocated -1119879168) (tried to allocate 1048581 bytes) in /usr/local/sbin/1/!testing0.php on line 13

Why displayed memory is negative? Int is using?

Test script:
---------------
<?php
ini_set('memory_limit', '3072M');
ini_set('display_startup_errors',1);
error_reporting(2045);
ini_set('display_errors',1);

$a = "";
for ($i = 0; $i < 1024; ++$i) $a .= chr($i%256);
$b = "";
for ($i = 0; $i < 1024; ++$i) $b .= $a;
$a = array();
for ($i = 0; $i < 4096; ++$i) $a[$i] = $b.$i;
?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-16 00:44 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2011-11-16 00:44 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Currently it's a long type.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Sep 08 14:00:01 2025 UTC