Index: /issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 16501)
+++ /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 16502)
@@ -92,14 +92,24 @@
 IoModel::~IoModel(){
 
-	/*Some checks in debugging mode*/
+	/*Delete independents*/
+	if(this->independents){
+		for(int i=0;i<MaximumNumberOfDefinitionsEnum;i++){
+			if(this->independents[i]){
+				IssmDouble* array=this->data[i];
+				xDelete<IssmDouble>(array);
+			}
+		}
+	}
+
+	/*checks in debugging mode*/
+	#ifdef _ISSM_DEBUG_
 	if(this->data){
 		for(int i=0;i<MaximumNumberOfDefinitionsEnum;i++){
 			if(this->data[i]){
-				/*Release data pertaining to Autodiff runs: */
-				IssmDouble* array=this->data[i];
-				xDelete<IssmDouble>(array);
-			}
-		}
-	}
+				printf0_("WARNING: previous pointer of " << EnumToStringx(i) << " has not been freed (DeleteData has not been called)\n");
+			}
+		}
+	}
+	#endif
 
 	if(this->constants) delete this->constants;
@@ -820,5 +830,5 @@
 
 		_assert_(this->independents);
-		if (this->independents[data_enum]){
+		if(this->independents[data_enum]){
 			/*this data has already been checked out! So cancel all that we've done here, and return 
 			 * the data[data_enum] directly: */
@@ -827,5 +837,5 @@
 		else{
 			*pmatrix=xNew<IssmDouble>(M*N);
-			for (int i=0;i<M*N;++i) (*pmatrix)[i]=matrix[i];
+			for(int i=0;i<M*N;++i) (*pmatrix)[i]=matrix[i];
 		}
 		xDelete<IssmPDouble>(matrix);
