Bug #54329 [Opn->Csd]: MSSql extension memory leak
| From: | felipe@php.net | Date: | Sun, 03 Jul 2011 19:01:48 +0000 |
| Subject: | Bug #54329 [Opn->Csd]: MSSql extension memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161543@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54329&edit=1
ID: 54329
Updated by: felipe@php.net
Reported by: dotslashpok at gmail dot com
Summary: MSSql extension memory leak
-Status: Open
+Status: Closed
Type: Bug
Package: MSSQL related
Operating System: Red Hat,Windows 7
PHP Version: 5.3SVN-2011-03-21 (SVN)
-Assigned To:
+Assigned To: felipe
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Thanks for the patch!
Previous Comments:
------------------------------------------------------------------------
[2011-07-03 15:01:42] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=312860
Log: - Fixed bug #54329 (MSSql extension memory leak)
patch by: dotslashpok at gmail dot com
------------------------------------------------------------------------
[2011-03-21 03:24:18] dotslashpok at gmail dot com
Description:
------------
Fetching data through dblib causes php memory usage to go up after each query.
This occurs even after unsetting the retrieved data.
This is because free_rows is not freeing the correct data.
Test script:
---------------
<?php
$db = new PDO('...','...','...');
$stmt = $db->prepare('SELECT TOP 100 * FROM Users');
echo "Start Memory : ".memory_get_peak_usage()."\n";
for ($i = 0; $i < 10; $i++) {
$stmt->execute();
$data = $stmt->fetchAll();
unset($data);
gc_collect_cycles();
echo $i." : ".memory_get_peak_usage()."\n";
}
echo "End Memory : ".memory_get_peak_usage()."\n";
Expected result:
----------------
Memory usage should be similar after each execution
Start Memory : 630824
0 : 1257944
1 : 1258024
2 : 1258920
3 : 1258920
4 : 1258984
5 : 1259048
6 : 1259096
7 : 1259224
8 : 1259288
9 : 1259296
End Memory : 1259296
Actual result:
--------------
Memory usage increases significantly after each execution
Start Memory : 630824
0 : 1257944
1 : 1321216
2 : 1384528
3 : 1447688
4 : 1510920
5 : 1574192
6 : 1637464
7 : 1700736
8 : 1763960
9 : 1827208
End Memory : 1827208
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54329&edit=1