Re: out of memory doing multiple inserts with DB_DataObject
| From: | Alan Knowles | Date: | Fri, 13 Feb 2004 11:09:36 +0000 |
| Subject: | Re: out of memory doing multiple inserts with DB_DataObject | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25647@lists.php.net to get a copy of this message | ||
Can you file it as a bug.
I'll have a look to see if it's failing to clear something..
Regards
Alan
todd wrote:
Hi, I've just started using DB_DataObject, and I'm trying to populate a table called "organization" with some dummy data. So I created a loop to insert 10000 rows. However, it's exceeding the 8MB memory limit on our server around the 4300th insert. Any idea why it's using so much memory? AccountId is a unique key in my organization table, but it is not the primary key. The primary key is auto incrementing (MySQL DB). Here is the sample code: DB_DataObject::DebugLevel(1); $org = new DataObject_ENOrganization(); $orgCnt = $org->count(); echo( "$orgCnt orgs <br>"); for($i = 0; $i < 10000; $i++) { $org->setId(null); $org->setAccountId($orgCnt + $i); $rslt = $org->insert(); } I also tried doing the inserts directly using PEAR:DB and it stays below the 8MB cap just fine. for($i = 0; $i < 10000; $i++) { $newAccountId = $orgCnt+$i; $db->query("INSERT INTO organization(accountId) VALUES($newAccountId)"); print_r("$i"); print_r("<BR>"); } Thanks, Todd Wallar-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com