Codeigniter:$query->free_result() when using active record?

20,387

PHP will clean up everything after your script is done. However, if you have lots of queries in, say, a loop, the results will not be cleaned up after each iteration.

So, if you run lots of queries in a loop, you probably will want to free_result() to clear up memory. Otherwise, it's not necessary. See here for details:

https://www.codeigniter.com/user_guide/database/results.html

Share:
20,387
metkappa
Author by

metkappa

Learning Rails Web Development

Updated on July 12, 2020

Comments

  • metkappa
    metkappa almost 4 years

    after i have finished with my result set from a active record query in a CodeIgniter model, should I use $query->free_result() or does ActiveRecord automatically do that?

  • user9645
    user9645 over 5 years
    The link no longer works. The relevant version 3 page is here