Edit report at https://bugs.php.net/bug.php?id=54329&edit=1

 ID:                 54329
 Updated by:         fel...@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] fel...@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

Reply via email to