Memory usage of codeigniter

1

I made my first application on codeigniter, at first it was working fine. But when I looked at the memory of the server, it is very high, starts with little use, and with each request it increases the use and does not release more. I do not know what to do at the moment. I already used the code $db['default']['save_queries'] = FALSE;

But it did not work, I added the code

function __destruct() {
    unset($this);
}

to try to free the memory used in $ this, but it did not do much for anything.

Any ideas how to free up used memory?

Thank you

    
asked by anonymous 11.08.2014 / 17:27

2 answers

1

I also had problems with overuse of memory and wrote this little cycle to release everything at the end of each load of the application.

Make print_r memory_get_usage() and memory_get_peak_usage() to see before and after cycling:

// DEVELOPMENT
print_r(memory_get_usage()); echo '<br>'; // Antes
print_r(memory_get_peak_usage()); echo '<br>';

foreach (array_keys(get_defined_vars()) as $var){
    unset($$var);
}

// DEVELOPMENT
print_r(memory_get_usage()); echo '<br>'; // Depois
    
13.08.2014 / 18:01
0

Look I think it may be the way it was developed, the CI makes many includes. how much more $ this-> load will use more memory will consume.

But it also has to see if the memory consumption is of the php or of the database.

    
13.08.2014 / 17:40