File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -401,6 +401,17 @@ Int FactorHiGHSSolver::analyseAS(Symbolic& S) {
401401 return status ? kStatusErrorAnalyse : kStatusOk ;
402402}
403403
404+ void FactorHiGHSSolver::freeNEmemory () {
405+ // Swap NE data structures with empty vectors, to guarantee that memory is
406+ // freed.
407+
408+ std::vector<Int>().swap (ptrNE_);
409+ std::vector<Int>().swap (rowsNE_);
410+ std::vector<Int>().swap (ptrNE_rw_);
411+ std::vector<Int>().swap (idxNE_rw_);
412+ std::vector<Int>().swap (corr_NE_);
413+ }
414+
404415Int FactorHiGHSSolver::analyseNE (Symbolic& S, int64_t nz_limit) {
405416 // Perform analyse phase of augmented system and return symbolic factorisation
406417 // in object S and the status. If building the matrix failed, the status is
@@ -507,6 +518,7 @@ Int FactorHiGHSSolver::chooseNla() {
507518 if (status != kStatusErrorAnalyse ) {
508519 if (options_.nla == kOptionNlaAugmented ) {
509520 S_ = std::move (symb_AS);
521+ freeNEmemory ();
510522 } else {
511523 S_ = std::move (symb_NE);
512524 }
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class FactorHiGHSSolver : public LinearSolver {
4242 int64_t nz_limit = kHighsIInf );
4343 Int buildNEvalues (const HighsSparseMatrix& A,
4444 const std::vector<double >& scaling);
45+ void freeNEmemory ();
4546
4647 Int analyseAS (Symbolic& S);
4748 Int analyseNE (Symbolic& S, int64_t nz_limit = kHighsIInf );
You can’t perform that action at this time.
0 commit comments