Bug #74174 [NEW]: Memory allocation problem
| From: | enleury at gmail dot com | Date: | Mon, 27 Feb 2017 12:31:32 +0000 |
| Subject: | Bug #74174 [NEW]: Memory allocation problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207576@lists.php.net to get a copy of this message | ||
From: enleury at gmail dot com
Operating system: Ubuntu
PHP version: 7.1.2
Package: Performance problem
Bug Type: Bug
Bug description:Memory allocation problem
Description:
------------
Memory is not freed after return from the method. Looks like a heap
defragmentation issue (https://bugs.php.net/bug.php?id=53669), but it
works fine on 5.x branches.
Online test script for 5.x and 7.x branches:
https://3v4l.org/2OVeU#output
Test script:
---------------
<?php
function create_docs($amount)
{
$documents = [];
for ($i = 0; $i < $amount; $i++) {
$documents[] = ['a' => $i];
}
}
echo memory_get_usage(true), PHP_EOL;
create_docs(5000);
echo memory_get_usage(true), PHP_EOL;
create_docs(50000);
echo memory_get_usage(true), PHP_EOL;
create_docs(5000);
echo memory_get_usage(true), PHP_EOL;
Expected result:
----------------
262144
524288
524288
524288
Actual result:
--------------
2097152
4194304
20971520
20971520
--
Edit bug report at https://bugs.php.net/bug.php?id=74174&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74174&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74174&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74174&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74174&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74174&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74174&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74174&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74174&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74174&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74174&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74174&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74174&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74174&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74174&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74174&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74174&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74174&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74174&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74174&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74174&r=mysqlcfg