Monday, September 12, 2011

Clean up CodeIgniter's database (ActiveRecord) memory usage

As what I have found when I was researching there are 2 ways:
  • Prevent ActiveRecord from saving query
by
$this->db->save_queries = false;
credit: how can I free the memory used by $this->db->insert()

  • Free result memory - CodeIgniter will only reclaim memory when http query processing was returned. If you request is long, you have to free by yourself
by
$query = $this->db->query('SELECT title FROM my_table');
$query->free_result();
credit: last section of Generating Query Results

No comments:

Config number of file descriptors on Linux

Check file descriptor limit for a process. Vary depending on owner of the process $ cat /proc/{process-id}/limits Check current number of...