diff --git a/examples/CoolingRates/cooling_rates.c b/examples/CoolingRates/cooling_rates.c
index c08fc5220ab03b65d05b57572e518c2efdc2b9b9..44b94f3253eda1a5027773adcd6341ced8dd33e6 100644
--- a/examples/CoolingRates/cooling_rates.c
+++ b/examples/CoolingRates/cooling_rates.c
@@ -135,7 +135,7 @@ int main(int argc, char **argv) {
   // Init cooling
   cooling_init(params, &us, &internal_const, &cooling);
   cooling_print(&cooling);
-  cooling_update(&cosmo, &cooling, 0);
+  cooling_update(&cosmo, &cooling, /*restart=*/0);
 
   // Calculate abundance ratios
   float abundance_ratio[(chemistry_element_count + 2)];
@@ -197,6 +197,10 @@ int main(int argc, char **argv) {
   fclose(output_file);
   message("done cooling rates test");
 
+  /* Clean everything */
+  cosmology_clean(&cosmo);
+  cooling_clean(&cooling);
+
   free(params);
   return 0;
 }
diff --git a/examples/main.c b/examples/main.c
index ecec9637be3f8c868be09496351ec9994038d28d..dbec184f757460b4da58301a596d20852dd64c61 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -1270,6 +1270,7 @@ int main(int argc, char *argv[]) {
   if (with_verbose_timers) timers_close_file();
   if (with_cosmology) cosmology_clean(e.cosmology);
   if (with_self_gravity) pm_mesh_clean(e.mesh);
+  if (with_cooling) cooling_clean(&cooling_func);
   engine_clean(&e);
   free(params);
 
diff --git a/src/cooling/Compton/cooling.h b/src/cooling/Compton/cooling.h
index 6d22157b453763d519ee47e0e35edeac75de646f..632e6e07b669dc8d847a35ab171b991e20c735ae 100644
--- a/src/cooling/Compton/cooling.h
+++ b/src/cooling/Compton/cooling.h
@@ -357,4 +357,11 @@ static INLINE void cooling_print_backend(
   message("Cooling function is 'Compton cooling'.");
 }
 
+/**
+ * @brief Clean-up the memory allocated for the cooling routines
+ *
+ * @param cooling the cooling data structure.
+ */
+static INLINE void cooling_clean(struct cooling_function_data* cooling) {}
+
 #endif /* SWIFT_COOLING_COMPTON_H */
diff --git a/src/cooling/EAGLE/cooling.c b/src/cooling/EAGLE/cooling.c
index 875151b5f5e827f5839c422415d382de2998c184..4c6bbc82c9ccbdf56757046ffd1fb0e90c33c527 100644
--- a/src/cooling/EAGLE/cooling.c
+++ b/src/cooling/EAGLE/cooling.c
@@ -1081,7 +1081,7 @@ void cooling_restore_tables(struct cooling_function_data *cooling,
   /* Read relevant cooling tables.
    * Third variable in cooling_update flag to mark restart*/
   allocate_cooling_tables(cooling);
-  cooling_update(cosmo, cooling, 1);
+  cooling_update(cosmo, cooling, /*restart=*/1);
 }
 
 /**
@@ -1089,7 +1089,32 @@ void cooling_restore_tables(struct cooling_function_data *cooling,
  *
  * @param cooling #cooling_function_data struct.
  */
-INLINE void cooling_print_backend(const struct cooling_function_data *cooling) {
+void cooling_print_backend(const struct cooling_function_data *cooling) {
 
   message("Cooling function is 'EAGLE'.");
 }
+
+/**
+ * @brief Clean-up the memory allocated for the cooling routines
+ *
+ * We simply free all the arrays.
+ *
+ * @param cooling the cooling data structure.
+ */
+void cooling_clean(struct cooling_function_data *cooling) {
+
+  /* Free the side arrays */
+  free(cooling->Redshifts);
+  free(cooling->nH);
+  free(cooling->Temp);
+  free(cooling->HeFrac);
+  free(cooling->Therm);
+  free(cooling->SolarAbundances);
+
+  /* Free the tables */
+  free(cooling->table.metal_heating);
+  free(cooling->table.electron_abundance);
+  free(cooling->table.temperature);
+  free(cooling->table.H_plus_He_heating);
+  free(cooling->table.H_plus_He_electron_abundance);
+}
diff --git a/src/cooling/EAGLE/cooling.h b/src/cooling/EAGLE/cooling.h
index 087f63fc63c35a68cd53dc56bc84ca4d91ceab87..f365ee9e7f1840957eb11fa785b4226901be9a93 100644
--- a/src/cooling/EAGLE/cooling.h
+++ b/src/cooling/EAGLE/cooling.h
@@ -103,4 +103,6 @@ void cooling_restore_tables(struct cooling_function_data *,
                             const struct cosmology *);
 
 void dump_cooling_struct(const struct cooling_function_data *);
+
+void cooling_clean(struct cooling_function_data *data);
 #endif /* SWIFT_COOLING_EAGLE_H */
diff --git a/src/cooling/const_du/cooling.h b/src/cooling/const_du/cooling.h
index de2c93edd06a4880048b27ffdd2f1c3318732b3f..eb9b098105b2f58baa3eadd2d14994b451da538d 100644
--- a/src/cooling/const_du/cooling.h
+++ b/src/cooling/const_du/cooling.h
@@ -227,4 +227,11 @@ static INLINE void cooling_print_backend(
           cooling->cooling_rate, cooling->min_energy);
 }
 
+/**
+ * @brief Clean-up the memory allocated for the cooling routines
+ *
+ * @param cooling the cooling data structure.
+ */
+static INLINE void cooling_clean(struct cooling_function_data* cooling) {}
+
 #endif /* SWIFT_COOLING_CONST_DU_H */
diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h
index e8c0f65f5b2633f21f5d096c1fa3001639e75625..eef62330ae9b52314ad0135b5390f9f31eb239e5 100644
--- a/src/cooling/const_lambda/cooling.h
+++ b/src/cooling/const_lambda/cooling.h
@@ -307,4 +307,11 @@ static INLINE void cooling_print_backend(
             cooling->cooling_tstep_mult);
 }
 
+/**
+ * @brief Clean-up the memory allocated for the cooling routines
+ *
+ * @param cooling the cooling data structure.
+ */
+static INLINE void cooling_clean(struct cooling_function_data* cooling) {}
+
 #endif /* SWIFT_COOLING_CONST_LAMBDA_H */
diff --git a/src/cooling/grackle/cooling.h b/src/cooling/grackle/cooling.h
index 470a4f31ee20ba1a5ef1627ebf23c515636bd206..ce71a370656a84c94f5d59c1b3bd75b547234620 100644
--- a/src/cooling/grackle/cooling.h
+++ b/src/cooling/grackle/cooling.h
@@ -825,5 +825,14 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend(
  */
 static INLINE void cooling_restore_tables(struct cooling_function_data* cooling,
                                           const struct cosmology* cosmo) {}
+/**
+ * @brief Clean-up the memory allocated for the cooling routines
+ *
+ * @param cooling the cooling data structure.
+ */
+static INLINE void cooling_clean(struct cooling_function_data* cooling) {
+
+  // MATTHIEU: To do: free stuff here
+}
 
 #endif /* SWIFT_COOLING_GRACKLE_H */
diff --git a/src/cooling/none/cooling.h b/src/cooling/none/cooling.h
index 9a44ecbd09c35066902df5619ca1e57391416069..868bfad7fc12c2f89d54949642bd5e9d902b42b6 100644
--- a/src/cooling/none/cooling.h
+++ b/src/cooling/none/cooling.h
@@ -171,4 +171,11 @@ static INLINE void cooling_print_backend(
   message("Cooling function is 'No cooling'.");
 }
 
+/**
+ * @brief Clean-up the memory allocated for the cooling routines
+ *
+ * @param cooling the cooling data structure.
+ */
+static INLINE void cooling_clean(struct cooling_function_data* cooling) {}
+
 #endif /* SWIFT_COOLING_NONE_H */