Bug #67898 [NEW]: Memory allocation problem - memory not freed

From: Date: Sun, 24 Aug 2014 11:53:34 +0000
Subject: Bug #67898 [NEW]: Memory allocation problem - memory not freed
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187257@lists.php.net to get a copy of this message
From: tomas at slax dot org Operating system: Slackware Linux PHP version: 5.5.16 Package: MySQL related Bug Type: Bug Bug description:Memory allocation problem - memory not freed 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 bug report at https://bugs.php.net/bug.php?id=67898&edit=1 --

« previous php.bugs (#187257) next »