COIN-OR::LEMON - Graph Library

Changeset 585:ba124394367a in lemon


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

Automatic GLPK env deallocation (#213)

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • lemon/glpk.cc

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

    r584 r585  
    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.
  • test/lp_test.cc

    r584 r585  
    367367    aTest(lp_glpk2);
    368368  }
    369   GlpkLp::freeEnv();
    370369#endif
    371370
  • test/mip_test.cc

    r584 r585  
    116116    aTest(mip1);
    117117  }
    118   GlpkLp::freeEnv();
    119118#endif
    120119
Note: See TracChangeset for help on using the changeset viewer.