Call wallcycle counter cleanup function
authorKevin Boyd <kevin.boyd@uconn.edu>
Thu, 20 Dec 2018 23:38:56 +0000 (18:38 -0500)
committerBerk Hess <hess@kth.se>
Fri, 21 Dec 2018 14:28:37 +0000 (15:28 +0100)
Cleans leak from unfreed wallcycle at end of mdrunner

Change-Id: I18c9a4eb961c1480230dda98c02f75e3796aa3b4

src/gromacs/mdrun/runner.cpp
src/gromacs/timing/wallcycle.cpp
src/gromacs/timing/wallcycle.h

index 060c83f33a562d917c606e4fe8c26529d489320c..f2578234ec46bff0390db83bcf9a502f710fb410 100644 (file)
@@ -1458,6 +1458,9 @@ int Mdrunner::mdrunner()
                pmedata,
                EI_DYNAMICS(inputrec->eI) && !isMultiSim(ms));
 
+    // clean up cycle counter
+    wallcycle_destroy(wcycle);
+
     // Free PME data
     if (pmedata)
     {
index 92ce8cb343cb6269564c9e1c1225618fb4f81efb..9655d9886800b415eb5dc5b5515063dfd578aedf 100644 (file)
@@ -205,9 +205,8 @@ gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, t_commrec gmx_unused
     return wc;
 }
 
-/* TODO: Should be called from finish_run() or runner()
-   void wallcycle_destroy(gmx_wallcycle_t wc)
-   {
+void wallcycle_destroy(gmx_wallcycle_t wc)
+{
     if (wc == nullptr)
     {
         return;
@@ -226,8 +225,7 @@ gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, t_commrec gmx_unused
         sfree(wc->wcsc);
     }
     sfree(wc);
-   }
- */
+}
 
 static void wallcycle_all_start(gmx_wallcycle_t wc, int ewc, gmx_cycles_t cycle)
 {
index 9468a0b60afd9fa6ef00973c3909bfb6c72eec42..cbf7596544203e8576efc03fad67001c69b51778 100644 (file)
@@ -90,6 +90,9 @@ gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, struct t_commrec *cr)
  * Returns NULL when cycle counting is not supported.
  */
 
+/* cleans up wallcycle structure */
+void wallcycle_destroy(gmx_wallcycle_t wc);
+
 void wallcycle_start(gmx_wallcycle_t wc, int ewc);
 /* Starts the cycle counter (and increases the call count) */