Bug->Req #67374 [Opn]: Integer Overflow in Memory Usage Functions

From: Date: Sat, 05 Jul 2014 23:18:04 +0000
Subject: Bug->Req #67374 [Opn]: Integer Overflow in Memory Usage Functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186478@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67374&edit=1 ID: 67374 Updated by: yohgaki@php.net Reported by: johannesdahse at gmx dot de Summary: Integer Overflow in Memory Usage Functions Status: Open -Type: Bug +Type: Feature/Change Request Package: PHP options/info functions PHP Version: 5.5.13 Block user comment: N Private report: N New Comment: I don't use windows often. AFAIK, int is 32bit under windows regardless of architecture. Therefore, overflow is spec. Is there any clean/feasible solution? Anyone? Previous Comments: ------------------------------------------------------------------------ [2014-06-03 14:42:37] johannesdahse at gmx dot de Description: ------------ The memory usage functions memory_get_usage() and memory_get_peak_usage() are limited by INTEGER and can only store the memory usage of 2.147 GB. This results in false reports for higher memory usage. Tested on Windows 7 64bit, PHP 5.5.13 (64bit and 32bit version). Test script: --------------- ini_set("memory_limit", "3G"); $a = array(); for($i=0; $i<22; $i++) $a[$i] = str_repeat("A", 100000000); echo memory_get_peak_usage(); Expected result: ---------------- 2200227928 Actual result: -------------- -2094739216 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67374&edit=1

« previous php.bugs (#186478) next »