Issue Type: Bug Created: 2008-12-05T16:33:09.000+0000 Last Updated: 2009-09-17T17:34:33.000+0000 Status: Resolved Fix version(s): Reporter: Michael Kliewe (mkliewe) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db
Related issues: Attachments: - memleak.zip
I have a problem with Zend_Db when using a mssql-database. I'm working several month with Zend Framework now, and was writing a kind of "windows service" in php (with php cli as service or scheduled task). This script runs very long (many days/weeks) in a loop. But I experienced memory problems with Zend_Db.
With each SQL-Query the Zend_Db object seems to grow a bit, depending on the select-result-size!!! Even with only one result row, the script-memory-usage grows. If I do INSERTs or UPDATES, all works fine, but when doing SELECTs, the script-memory-usage grows and grows. And my script runs many days and has 100.000 selects a day, which results in >100MB memory usage growth per day. So I have to restart the script every day ;-(
Zend_Db seems to cache that results or so, I don't know. Zend_Db_Profiler is disabled of cause.
I did a few tests, tested PEAR-MDB2 and also Zend_Db Pdo_Sqlite-Adapter . With these two methods I didn't experience a memory growth.
I will attach my test files, so you can check it on your own. You will need PEAR MDB2 installed to run it (or you disable that part). I will also attach my results (results.txt), where you can see, that sqlite and mdb2 don't grow, but mssql does!
I cannot use Zend_Db with that bug. Please fix it soon!
Posted by Michael Kliewe (mkliewe) on 2008-12-05T16:34:44.000+0000
zip archive with my test script and results.txt, where you can see the problem with mssql-adapter
Posted by Petr Gottvald (gotys) on 2009-09-08T00:51:17.000+0000
I ran into the same exact issue yesterday. It doesn't seem Zend_Db was written with memory leaks in mind. Running a PHP Daemon using Zend_Db is impossible right now. I am examining the source codes of Zend_Framework right now and will report if I find something.
Someone please fix this!
Posted by Petr Gottvald (gotys) on 2009-09-08T02:05:25.000+0000
Well, I think I solved my problem . It was much easier then I thought. My memory kept leaking with when I had the Query Profiler turned on. I turned it off, now memory stopped leaking. Let me know if this solved your issue as well.
Have you found an issue?
See the Overview section for more details.