Edit report at https://bugs.php.net/bug.php?id=62111&edit=1
ID: 62111 User updated by: hosiplan at gmail dot com Reported by: hosiplan at gmail dot com Summary: MySQL PDO memory leaks, when used own result row class Status: Open Type: Bug Package: PDO related Operating System: Linux PHP Version: 5.4.4RC1 Block user comment: N Private report: N New Comment: I don't really care what you name it. It's a real problem and its eating my memory and it shouldn't! Previous Comments: ------------------------------------------------------------------------ [2012-06-12 13:33:16] u...@php.net There is no leak with MySQL. Memory usage increases, that's it. ==6216== LEAK SUMMARY: ==6216== definitely lost: 0 bytes in 0 blocks ==6216== indirectly lost: 0 bytes in 0 blocks ==6216== possibly lost: 0 bytes in 0 blocks ==6216== still reachable: 54 bytes in 2 blocks ==6216== suppressed: 0 bytes in 0 blocks ==6216== Rerun with --leak-check=full to see details of leaked memory ------------------------------------------------------------------------ [2012-06-11 13:48:11] juzna dot cz at gmail dot com The same causes PHP to crash completely on Windows 32bit with MSSQL server (using sqlsrv driver). I guess the root cause will be related. ------------------------------------------------------------------------ [2012-05-22 20:39:55] juzna dot cz at gmail dot com Leaks with mysql, no leaks with sqlite. No need to fetchAll(); execute() is enough to get leaks ------------------------------------------------------------------------ [2012-05-22 20:12:17] hosiplan at gmail dot com affected version ------------------------------------------------------------------------ [2012-05-22 20:10:33] hosiplan at gmail dot com Sorry, I've coppied wrong code Test script: --------------- $db = new PDO('mysql:host=127.0.0.1;dbname=information_schema', 'root', 'password'); class DbRow { public function __construct($stt = NULL) { } } $begin = memory_get_usage(); for ($i=0; $i < 10 ;$i++) { $stt = $db->prepare("SELECT * FROM COLLATIONS"); $stt->setFetchMode(PDO::FETCH_CLASS, 'DbRow', array($stt)); $stt->execute(); $rows = $stt->fetchAll(); echo number_format((memory_get_usage() - $begin) / 1000000, 2, '.', ' '), " MB\n"; } ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=62111 -- Edit this bug report at https://bugs.php.net/bug.php?id=62111&edit=1