|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesdblibmemoryleakfix (last revision 2011-03-21 02:25 UTC by dotslashpok at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-03 15:01 UTC] felipe@php.net
[2011-07-03 15:01 UTC] felipe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: felipe
[2011-07-03 15:01 UTC] felipe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
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