1.1 --- a/lemon/glpk.cc Sun Mar 01 07:10:49 2009 +0000
1.2 +++ b/lemon/glpk.cc Wed Mar 04 13:43:05 2009 +0000
1.3 @@ -522,6 +522,12 @@
1.4 cols.clear();
1.5 }
1.6
1.7 + void GlpkBase::freeEnv() {
1.8 + glp_free_env();
1.9 + }
1.10 +
1.11 + GlpkBase::FreeEnvHelper GlpkBase::freeEnvHelper;
1.12 +
1.13 // GlpkLp members
1.14
1.15 GlpkLp::GlpkLp()
2.1 --- a/lemon/glpk.h Sun Mar 01 07:10:49 2009 +0000
2.2 +++ b/lemon/glpk.h Wed Mar 04 13:43:05 2009 +0000
2.3 @@ -100,6 +100,18 @@
2.4
2.5 virtual void _clear();
2.6
2.7 + private:
2.8 +
2.9 + static void freeEnv();
2.10 +
2.11 + struct FreeEnvHelper {
2.12 + ~FreeEnvHelper() {
2.13 + freeEnv();
2.14 + }
2.15 + };
2.16 +
2.17 + static FreeEnvHelper freeEnvHelper;
2.18 +
2.19 public:
2.20
2.21 ///Pointer to the underlying GLPK data structure.