Changeset 16502


Ignore:
Timestamp:
10/22/13 08:42:26 (11 years ago)
Author:
Mathieu Morlighem
Message:

CHG: readded check that all iomodel->data are freed

File:
1 edited

Legend:

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

    r16501 r16502  
    9292IoModel::~IoModel(){
    9393
    94         /*Some checks in debugging mode*/
     94        /*Delete independents*/
     95        if(this->independents){
     96                for(int i=0;i<MaximumNumberOfDefinitionsEnum;i++){
     97                        if(this->independents[i]){
     98                                IssmDouble* array=this->data[i];
     99                                xDelete<IssmDouble>(array);
     100                        }
     101                }
     102        }
     103
     104        /*checks in debugging mode*/
     105        #ifdef _ISSM_DEBUG_
    95106        if(this->data){
    96107                for(int i=0;i<MaximumNumberOfDefinitionsEnum;i++){
    97108                        if(this->data[i]){
    98                                 /*Release data pertaining to Autodiff runs: */
    99                                 IssmDouble* array=this->data[i];
    100                                 xDelete<IssmDouble>(array);
    101                         }
    102                 }
    103         }
     109                                printf0_("WARNING: previous pointer of " << EnumToStringx(i) << " has not been freed (DeleteData has not been called)\n");
     110                        }
     111                }
     112        }
     113        #endif
    104114
    105115        if(this->constants) delete this->constants;
     
    820830
    821831                _assert_(this->independents);
    822                 if (this->independents[data_enum]){
     832                if(this->independents[data_enum]){
    823833                        /*this data has already been checked out! So cancel all that we've done here, and return
    824834                         * the data[data_enum] directly: */
     
    827837                else{
    828838                        *pmatrix=xNew<IssmDouble>(M*N);
    829                         for (int i=0;i<M*N;++i) (*pmatrix)[i]=matrix[i];
     839                        for(int i=0;i<M*N;++i) (*pmatrix)[i]=matrix[i];
    830840                }
    831841                xDelete<IssmPDouble>(matrix);
Note: See TracChangeset for help on using the changeset viewer.