Bug #67898 [Opn]: Memory allocation problem - memory not freed
| From: | tomas at slax dot org | Date: | Sun, 24 Aug 2014 17:57:36 +0000 |
| Subject: | Bug #67898 [Opn]: Memory allocation problem - memory not freed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187263@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67898&edit=1
ID: 67898
User updated by: tomas at slax dot org
Reported by: tomas at slax dot org
Summary: Memory allocation problem - memory not freed
Status: Open
Type: Bug
Package: MySQL related
Operating System: Slackware Linux
PHP Version: 5.5.16
Block user comment: N
Private report: N
New Comment:
The same issue can be observed on PHP 5.4.20.
The same issue can be reproduces on PHP 5.6.0RC4 :(
All compiled on Slackware Linux.
Previous Comments:
------------------------------------------------------------------------
[2014-08-24 11:53:34] tomas at slax dot org
Description:
------------
If I simply get data from MySQL, PHP consumes more memory for every row:
With some older PHP 5.3 versions, it prints constant number all the time, because RAM is properly
freed. But with PHP 5.5.15 and 5.5.16 it prints increased amount of RAM for each row, as like the
memory is not properly freed. If the mysql table has lots of rows, PHP script ends on trying to
allocate more memory than allowed in php.ini
The same problem appears when using mysql_fetch_row(). The same problem appears when using MySQLi
extension instead of mysql. The same problem is there if using PHP on command line, the same problem
when using PHP as Apache's module.
I compile PHP from sources, using this configure script:
CFLAGS="-O2 -fPIC" ./configure \
--libdir=/usr/lib64 \
--with-libdir=lib64 \
--disable-debug \
--disable-libxml --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter \
--disable-dom \
--enable-mbstring --enable-mbregex \
--without-sqlite3 \
--without-pdo_sqlite \
--without-pear \
--with-mysql \
--with-mysqli \
--enable-ftp \
--with-iconv \
--with-zlib \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-openssl \
--with-gd \
--with-freetype-dir=/usr \
--enable-gd-native-ttf \
--with-apxs2=/usr/bin/apxs \
--build=x86_64-slackware-linux
Test script:
---------------
$result=mysql_query("SELECT * FROM table");
while($row=mysql_fetch_assoc($result))
{
echo memory_get_usage()."\n";
}
Expected result:
----------------
I expect PHP to print constant number since it should not allocate more RAM. Like
501320
501320
501320
501320
501320
501320
501320
501320
...
Actual result:
--------------
I get increased number of used RAM
56000376
56001384
56002392
56003400
56004408
56005416
56006424
56007432
56008440
56009448
56010456
56011464
56012472
56013480
56014488
56015496
56016504
56017512
56018520
56019528
56020536
56021544
56022552
56023560
56024568
56025576
56026584
56027592
56028600
56029608
...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67898&edit=1