From:
Operating system: Red Hat,Windows 7
PHP version: 5.3SVN-2011-03-21 (SVN)
Package: MSSQL related
Bug Type: Bug
Bug description:MSSql extension memory leak
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 bug report at http://bugs.php.net/bug.php?id=54329&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54329&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54329&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54329&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54329&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54329&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54329&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54329&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54329&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54329&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54329&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54329&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54329&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54329&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54329&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54329&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54329&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54329&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54329&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54329&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54329&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54329&r=mysqlcfg