DB_DataObject eats all my memory
| From: | Sven Lankes | Date: | Mon, 25 Oct 2004 09:17:07 +0000 |
| Subject: | DB_DataObject eats all my memory | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-15089@lists.php.net to get a copy of this message | ||
I have a script where I'm doing a lot of sql queries.
This script eats memory until it's killed by the OOM-Killer
at some point (using much more than 1GB).
DB_DataObjects seems to be at fault.
I have created a very simple testcase:
> for ($i = 1; $i < 50000; $i++) {
> $test = new DataObjects_Test;
> $test->whereAdd("field2 like '4%'");
> $test->find();
> while ($test->fetch()) {
> }
> }
The Test-Table consists of 100000 lines of random noise.
If I run above code it starts out with a ps aux output
of:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
sven 15451 41.0 1.4 94612 15308 pts/7 S+ 00:09 0:00 php ./read.php
after a couple of hours it looks like this:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
sven 15451 73.4 7.4 155560 76160 pts/7 S+ 00:09 382:40 php ./read.php
Rewriting my test-script using only the php postgres commands
I can run it for hours w/o an increase in memory consumption.
Any hints on how to solve this would be appreaciated.
I'm using php 4.3.9, postgres 7.4.5 and DB_DataObject 1.7.2
--
mfg sven lankes
megabit informationstechnik