Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp	(revision 12428)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp	(revision 12429)
@@ -33,5 +33,5 @@
 	this->N=pN;
 	this->matrix=NULL;
-	if(M*N) this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
+	if(M*N) this->matrix=xNewInit<double>(pM*pN,0.0);
 }
 /*}}}*/
@@ -42,5 +42,5 @@
 	this->N=pN;
 	this->matrix=NULL;
-	if(M*N) this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
+	if(M*N) this->matrix=xNewInit<double>(pM*pN,0.0);
 }
 /*}}}*/
@@ -54,5 +54,5 @@
 	this->matrix=NULL;
 	if(M*N){
-		this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
+		this->matrix=xNewInit<double>(pM*pN,0.0);
 		memcpy(this->matrix,serial_mat,pM*pN*sizeof(double));
 	}
@@ -66,5 +66,5 @@
 	this->N=pN;
 	this->matrix=NULL;
-	if(M*N)this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
+	if(M*N) this->matrix=xNewInit<double>(pM*pN,0.0);
 }
 /*}}}*/
@@ -72,5 +72,5 @@
 SeqMat::~SeqMat(){
 
-	xfree((void**)&this->matrix);
+	xDelete<double>(this->matrix);
 	M=0;
 	N=0;
@@ -178,5 +178,5 @@
 
 	if(this->M*this->N){
-		buffer=(double*)xmalloc(this->M*this->N*sizeof(double));
+		buffer=xNew<double>(this->M*this->N);
 		memcpy(buffer,this->matrix,this->M*this->N*sizeof(double));
 	}
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.cpp	(revision 12428)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.cpp	(revision 12429)
@@ -31,5 +31,5 @@
 	this->M=pM;
 	this->vector=NULL;
-	if(this->M) this->vector=(double*)xcalloc(pM,sizeof(double));
+	if(this->M) this->vector=xNewInit<double>(pM,0.0);
 }
 /*}}}*/
@@ -42,5 +42,5 @@
 	this->vector=NULL;
 	if(this->M){
-		this->vector=(double*)xcalloc(pM,sizeof(double));
+		this->vector=xNewInit<double>(pM,0.0);
 		memcpy(this->vector,buffer,pM*sizeof(double));
 	}
@@ -49,5 +49,5 @@
 		/*FUNCTION SeqVec::~SeqVec(){{{*/
 SeqVec::~SeqVec(){
-	xfree((void**)&this->vector);
+	xDelete<double>(this->vector);
 	M=0;
 }
@@ -170,5 +170,5 @@
 
 	if(this->M){
-		buffer=(double*)xmalloc(this->M*sizeof(double));
+		buffer=xNew<double>(this->M);
 		memcpy(buffer,this->vector,this->M*sizeof(double));
 	}
Index: /issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp	(revision 12428)
+++ /issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp	(revision 12429)
@@ -13,5 +13,5 @@
 	METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart); 
 	#elif _METIS_VERSION_ == 5
-	/*This interface is heavily changed. More options, different way of meshing, etc ...: */ 
+	/*This interface is heavily changed. More options, different ways of meshing, etc ...: */ 
 	int i;
 
@@ -21,6 +21,4 @@
 	idx_t  k=0;
 	real_t* tpwgts=NULL;
-
-
 
 	/*setup options: */
@@ -40,7 +38,6 @@
 	options[METIS_OPTION_NCUTS]   = 1;
 
-
 	/*create eptr: */
-	eptr=(idx_t*)xmalloc((*pnumberofelements+1)*sizeof(idx_t));
+	eptr=xNew<idx_t>((*pnumberofelements+1));
 	eptr[0]=0;
 	for(i=0;i<*pnumberofelements;i++){
@@ -49,16 +46,12 @@
 	}
 
-
 	/*create tpwgts: */
-	tpwgts=(real_t*)xmalloc(*pnum_procs*sizeof(real_t));
+	tpwgts=xNew<real_t>(*pnum_procs);
 	for(i=0;i<*pnum_procs;i++){
 		tpwgts[i]=1.0/(*pnum_procs);
 	}
 
-
 	METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, eptr, index,
-			NULL, NULL, pnum_procs, tpwgts, options, &objval,
-			epart, npart);
-	
+			NULL, NULL, pnum_procs, tpwgts, options, &objval,epart, npart);
 
 	#else
Index: /issm/trunk-jpl/src/c/toolkits/mpi/patches/DetermineLocalSize.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/mpi/patches/DetermineLocalSize.cpp	(revision 12428)
+++ /issm/trunk-jpl/src/c/toolkits/mpi/patches/DetermineLocalSize.cpp	(revision 12429)
@@ -5,6 +5,4 @@
 #include <stdio.h>
 #include <math.h>
-
-
 #include "../../../shared/shared.h"
 
@@ -24,8 +22,7 @@
 	
 	/*We are  not bound by any library, just use what seems most logical*/
-	num_local_rows=(int*)xmalloc(num_procs*sizeof(int));    
+	num_local_rows=xNew<int>(num_procs);    
 
 	for (i=0;i<num_procs;i++){
-
 		/*Here, we use floor. We under distribute rows. The rows 
 		  left  are then redistributed, therefore resulting in a 
@@ -39,9 +36,8 @@
 		num_local_rows[i]++;
 	}
-
 	local_size=num_local_rows[my_rank];
 	
 	/*free ressources: */
-	xfree((void**)&num_local_rows);
+	xDelete<double>(num_local_rows);
 
 	/*return size: */
Index: /issm/trunk-jpl/src/c/toolkits/mpi/patches/MPI_Boundariesfromrange.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/mpi/patches/MPI_Boundariesfromrange.cpp	(revision 12428)
+++ /issm/trunk-jpl/src/c/toolkits/mpi/patches/MPI_Boundariesfromrange.cpp	(revision 12429)
@@ -20,7 +20,6 @@
 
 	/*Gather all range values into allranges, for all nodes*/
-	allranges=(int*)xmalloc(num_procs*sizeof(int));
+	allranges=xNew<int>(num_procs);
 	MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,MPI_COMM_WORLD);
-
 
 	/*From all ranges, get lower row and upper row*/
@@ -31,12 +30,9 @@
 		upper_row=upper_row+allranges[i];
 	}
-	
-	/*free: */
-	xfree((void**)&allranges);
 
 	/*Assign output pointers: */
+	xDelete<double>(allranges);
 	*plower_row=lower_row;
 	*pupper_row=upper_row;
-
 	return 1;
 }
