Bug #71469 [NEW]: mysqli_fetch_field increases memory usage by large amount

From: Date: Thu, 28 Jan 2016 00:22:44 +0000
Subject: Bug #71469 [NEW]: mysqli_fetch_field increases memory usage by large amount
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198925@lists.php.net to get a copy of this message
From: ryan dot brothers at gmail dot com Operating system: Linux PHP version: 5.6.17 Package: MySQLi related Bug Type: Bug Bug description:mysqli_fetch_field increases memory usage by large amount Description: ------------ I am seeing an issue in PHP 5.6.17 where after running a large database query, calling mysqli_fetch_field increases memory usage by a large amount. The same issue occurs in PHP 7.0.2. In the below example, the call to fetch_field increases the memory usage from 1.8MB to 6.6MB. I have placed SQL to create a test table of 100,000 rows at https://drive.google.com/uc?export=download&id=0B37DKbJklxg_Y3NadnRjc2tVbE0. Is this expected behavior or an issue with memory usage? Thanks for your help. Test script: --------------- <?php $mysqli = new mysqli('localhost', 'test', 'test', 'test'); $mysqli->real_query("SELECT * FROM a"); $result = $mysqli->store_result(); echo 'a: '.memory_get_usage()."\n"; $field = $result->fetch_field(); echo 'b: '.memory_get_usage()."\n"; exit; Expected result: ---------------- a: 1833136 b: 1833136 (or close to it) Actual result: -------------- a: 1833136 b: 6635728 -- Edit bug report at https://bugs.php.net/bug.php?id=71469&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71469&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71469&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71469&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71469&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71469&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71469&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71469&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71469&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71469&r=support Expected behavior: https://bugs.php.net/fix.php?id=71469&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71469&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71469&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71469&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71469&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71469&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71469&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71469&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71469&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71469&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71469&r=mysqlcfg

« previous php.bugs (#198925) next »