Bug #71468 [Opn->Fbk]: increased memory usage with mysqli in php 7

From: Date: Mon, 22 Feb 2016 05:43:50 +0000
Subject: Bug #71468 [Opn->Fbk]: increased memory usage with mysqli in php 7
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199379@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71468&edit=1 ID: 71468 Updated by: rasmus@php.net Reported by: ryan dot brothers at gmail dot com Summary: increased memory usage with mysqli in php 7 -Status: Open +Status: Feedback Type: Bug Package: MySQLi related Operating System: Linux PHP Version: 7.0.2 Block user comment: N Private report: N New Comment: Are you sure that your mysqli was compiled against mysqlnd in both PHP 5 and PHP 7? On your phpinfo() page, in the mysqli section, what does it say for "Client API library version" in both PHP 5 and 7? The reason being, if PHP 5 was compiled against libmysqlclient then since libmysqlclient does not use the PHP memory allocator none of the memory allocated by that library is reported by memory_get_usage(). That doesn't mean it wasn't allocated, of course. Previous Comments: ------------------------------------------------------------------------ [2016-02-21 23:00:15] rendername at gmail dot com We have the same issue, does anyone have any idea? php5 - 45mb, php7 - 250mb Debian 8 (jessie) 64bit ------------------------------------------------------------------------ [2016-01-28 11:53:16] ryan dot brothers at gmail dot com Yes, mysqlnd is used in both. PHP was compiled with --with-mysqli. ------------------------------------------------------------------------ [2016-01-28 03:02:25] laruence@php.net do they all used mysqlnd? ------------------------------------------------------------------------ [2016-01-27 23:57:23] ryan dot brothers at gmail dot com Description: ------------ I am seeing an issue in PHP 7 where large database queries are taking up more memory compared to PHP 5.6. In the below example, PHP 7 uses 8.3MB while PHP 5.6 only uses 1.8MB. 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 PHP 7 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 memory_get_usage()."\n"; exit; Expected result: ---------------- PHP 5.6.17: 1832472 PHP 7.0.2: 1832472 (or close to it) Actual result: -------------- PHP 5.6.17: 1832472 PHP 7.0.2: 8356704 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71468&edit=1

« previous php.bugs (#199379) next »