ecometer

Free up the memory of variables that are no longer needed

(Development)
#49

Free up the RAM as soon as possible. In particular, delete tables that quickly fill up with large amounts of information.

Optimize the following code:

$crm = new CrmConnection();
$this_month_clients = $crm->fetchAllClients()->filtersByLastActivity(LAST_MONTH);
$recipes = some_long_function_which_extracts_recipes_from_clients($this_month_clients);
$pdfs = generate_pdf_for_recipes($recipes);
return $pdfs;

by:

$crm = new CrmConnection();
$this_month_clients = $crm->fetchAllClients()->filtersByLastActivity(LAST_MONTH);
unset($crm);
$recipes = some_long_function_which_extracts_recipes_from_clients($this_month_clients);
$pdfs = generate_pdf_for_recipes($recipes); 
unset($recipes);
return $pdfs;