changeset 21445:de155ca994d4

Ask glpk to free all resources used after solving problem. * __glpk__.cc (glpk): Call glp_free_env () at end of routine to free all resources. Prevents memory leaks being reported.
author Rik <rik@octave.org>
date Sun, 13 Mar 2016 08:46:59 -0700
parents 74b07936fd05
children 822dc5a202c9
files libinterp/dldfcn/__glpk__.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__glpk__.cc	Sun Mar 13 07:34:27 2016 -0700
+++ b/libinterp/dldfcn/__glpk__.cc	Sun Mar 13 08:46:59 2016 -0700
@@ -285,6 +285,11 @@
     }
 
   glp_delete_prob (lp);
+  // Request that GLPK free all memory resources.
+  // This prevents reported memory leaks, but isn't strictly necessary.
+  // The memory blocks use are allocated once and don't grow with further
+  // calls to glpk so they would be reclaimed anyways when Octave exits. 
+  glp_free_env ();
 
   return errnum;
 }