COIN-OR::LEMON - Graph Library

Changeset 538:ba124394367a in lemon-1.2 for lemon


Ignore:
Timestamp:
02/23/09 23:44:29 (11 years ago)
Author:
Balazs Dezso <deba@…>
Branch:
default
Phase:
public
Message:

Automatic GLPK env deallocation (#213)

Location:
lemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/glpk.cc

    r537 r538  
    526526    glp_free_env();
    527527  }
     528
     529  GlpkBase::FreeEnvHelper GlpkBase::freeEnvHelper;
    528530
    529531  // GlpkLp members
  • lemon/glpk.h

    r537 r538  
    101101    virtual void _clear();
    102102
    103   public:
    104 
    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.
     103  private:
     104
    111105    static void freeEnv();
     106
     107    struct FreeEnvHelper {
     108      ~FreeEnvHelper() {
     109        freeEnv();
     110      }
     111    };
     112   
     113    static FreeEnvHelper freeEnvHelper;
     114   
     115  public:
    112116
    113117    ///Pointer to the underlying GLPK data structure.
Note: See TracChangeset for help on using the changeset viewer.