gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Automatic GLPK env deallocation (#213)
0 4 0
default
4 files changed with 14 insertions and 10 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -528,2 +528,4 @@
528 528

	
529
  GlpkBase::FreeEnvHelper GlpkBase::freeEnvHelper;
530

	
529 531
  // GlpkLp members
Show white space 6 line context
... ...
@@ -102,12 +102,16 @@
102 102

	
103
  private:
104

	
105
    static void freeEnv();
106

	
107
    struct FreeEnvHelper {
108
      ~FreeEnvHelper() {
109
        freeEnv();
110
      }
111
    };
112
    
113
    static FreeEnvHelper freeEnvHelper;
114
    
103 115
  public:
104 116

	
105
    /// \brief Deallocates the globally allocated memory of GLPK.
106

	
107
    /// Deallocates the globally allocated memory of GLPK.  \note
108
    /// Usually, it do not have to be called, because the GLPK use
109
    /// only a small amount of global memory, and it is deallocated
110
    /// automatically at the end of program.
111
    static void freeEnv();
112

	
113 117
    ///Pointer to the underlying GLPK data structure.
Ignore white space 6 line context
... ...
@@ -368,3 +368,2 @@
368 368
  }
369
  GlpkLp::freeEnv();
370 369
#endif
Ignore white space 6 line context
... ...
@@ -117,3 +117,2 @@
117 117
  }
118
  GlpkLp::freeEnv();
119 118
#endif
0 comments (0 inline)