Changeset 24681


Ignore:
Timestamp:
04/01/20 09:55:09 (5 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixing memory leak

Location:
issm/trunk-jpl/src/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Nodes.cpp

    r23926 r24681  
    185185         * up by their clones: */
    186186        int  maxdofspernode = this->MaxNumDofs(setenum);
    187         int* truedofs       = xNew<int>(this->Size()*maxdofspernode); //only one alloc
     187        int* truedofs       = xNewZeroInit<int>(this->Size()*maxdofspernode); //only one alloc
    188188        for(int rank=0;rank<num_procs;rank++){
    189189                if(this->common_send[rank]){
  • issm/trunk-jpl/src/c/solutionsequences/solutionsequence_nonlinear.cpp

    r24680 r24681  
    8585                InputUpdateFromSolutionx(femmodel,ug);
    8686
     87                /*Clean up if rifts*/
     88                if(femmodel->loads->numrifts){
     89                        delete Kfs; delete Kff; delete pf; delete df;
     90                }
     91
    8792                ConstraintsStatex(&constraints_converged,&num_unstable_constraints,femmodel);
    8893                if(VerboseConvergence()) _printf0_("   number of unstable constraints: " << num_unstable_constraints << "\n");
     
    111116                }
    112117
    113                 // Set the matrix entries to zero if we do an other iteration
    114                 Kff->SetZero();
    115                 Kfs->SetZero();
    116                 df->Set(0);
    117                 pf->Set(0);
     118                /*Set the matrix entries to zero if we do an other iteration*/
     119                if(femmodel->loads->numrifts==0){
     120                        Kff->SetZero();
     121                        Kfs->SetZero();
     122                        df->Set(0);
     123                        pf->Set(0);
     124                }
    118125        }
    119126
    120         // delete matrices after the iteration loop
    121         delete Kff; delete pf; delete df;
    122         delete Kfs;
     127        /*delete matrices after the iteration loop*/
     128        if(femmodel->loads->numrifts==0){
     129                delete Kff; delete pf; delete df; delete Kfs;
     130        }
    123131
    124132        if(VerboseConvergence()) _printf0_("\n   total number of iterations: " << count << "\n");
Note: See TracChangeset for help on using the changeset viewer.