iterating many rows consumes a LOT of memory |
I've got utility scripts I use to tidy up my data before deploying it to my production site. One script in particular has to fetch a lot of records and iterate them all (NOTE: I have *tried* to refactor this code to work some other way but cannot find another way to do it without iterating all the records). This is causing CodeIgniter to chew up a LOT of memory and I'm getting an 'out of memory' error. Seems to me like CI's mysqli driver might have a memory leak? Is there something I can do to improve memory management for a script? Here's an example script:
PHP Code: public function example() { Code: 90121 rows found Am I missing something? Note that I set $this->db->save_queries to FALSE and I'm using $query->unbuffered_row() and I still have this problem. I have been searching and I see a post from four years ago which IMHO was prematurely closed. My CI version is 3.0.7-dev downloaded from github today.
maybe someone has an idea. but the other angle is to figure out how you can change the database tables so you have ids or date or something so that you can process them in logical batches.
>>> chew up a LOT of memory and I'm getting an 'out of memory' error.
Are the search fields indexed and why request all t4.* fields? |
Welcome Guest, Not a member yet? Register Sign In |