[Lemon-commits] Balazs Dezso: Fix GLPK tests (#213)

Lemon HG hg at lemon.cs.elte.hu
Wed Mar 4 14:54:46 CET 2009


details:   http://lemon.cs.elte.hu/hg/lemon/rev/0fec6a017ead
changeset: 559:0fec6a017ead
user:      Balazs Dezso <deba [at] inf.elte.hu>
date:      Mon Feb 23 22:54:25 2009 +0100
description:
	Fix GLPK tests (#213)

diffstat:

4 files changed, 14 insertions(+)
lemon/glpk.cc    |    4 ++++
lemon/glpk.h     |    8 ++++++++
test/lp_test.cc  |    1 +
test/mip_test.cc |    1 +

diffs (54 lines):

diff --git a/lemon/glpk.cc b/lemon/glpk.cc
--- a/lemon/glpk.cc
+++ b/lemon/glpk.cc
@@ -522,6 +522,10 @@
     cols.clear();
   }
 
+  void GlpkBase::freeEnv() {
+    glp_free_env();
+  }
+
   // GlpkLp members
 
   GlpkLp::GlpkLp()
diff --git a/lemon/glpk.h b/lemon/glpk.h
--- a/lemon/glpk.h
+++ b/lemon/glpk.h
@@ -102,6 +102,14 @@
 
   public:
 
+    /// \brief Deallocates the globally allocated memory of GLPK.
+
+    /// Deallocates the globally allocated memory of GLPK.  \note
+    /// Usually, it do not have to be called, because the GLPK use
+    /// only a small amount of global memory, and it is deallocated
+    /// automatically at the end of program.
+    static void freeEnv();
+
     ///Pointer to the underlying GLPK data structure.
     LPX *lpx() {return lp;}
     ///Const pointer to the underlying GLPK data structure.
diff --git a/test/lp_test.cc b/test/lp_test.cc
--- a/test/lp_test.cc
+++ b/test/lp_test.cc
@@ -366,6 +366,7 @@
     lpTest(lp_glpk1);
     aTest(lp_glpk2);
   }
+  GlpkLp::freeEnv();
 #endif
 
 #ifdef HAVE_CPLEX
diff --git a/test/mip_test.cc b/test/mip_test.cc
--- a/test/mip_test.cc
+++ b/test/mip_test.cc
@@ -115,6 +115,7 @@
     GlpkMip mip1;
     aTest(mip1);
   }
+  GlpkLp::freeEnv();
 #endif
 
 #ifdef HAVE_CPLEX



More information about the Lemon-commits mailing list