Index: /issm/trunk-jpl/src/c/shared/Elements/CoordinateSystemTransform.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Elements/CoordinateSystemTransform.cpp	(revision 12434)
+++ /issm/trunk-jpl/src/c/shared/Elements/CoordinateSystemTransform.cpp	(revision 12435)
@@ -27,5 +27,5 @@
 
 	/*Allocate and initialize transform matrix*/
-	transform=(double*)xmalloc(numdofs*numdofs*sizeof(double));
+	transform=xNew<double>(numdofs*numdofs);
 	for(i=0;i<numdofs*numdofs;i++) transform[i]=0.0;
 
Index: /issm/trunk-jpl/src/c/shared/Elements/TransformInvStiffnessMatrixCoord.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Elements/TransformInvStiffnessMatrixCoord.cpp	(revision 12434)
+++ /issm/trunk-jpl/src/c/shared/Elements/TransformInvStiffnessMatrixCoord.cpp	(revision 12435)
@@ -9,5 +9,5 @@
 
 	/*All nodes have the same Coordinate System*/
-	cs_array=(int*)xmalloc(numnodes*sizeof(int));
+	cs_array=xNew<int>(numnodes);
 	for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
 
@@ -16,5 +16,5 @@
 
 	/*Clean-up*/
-	xfree((void**)&cs_array);
+	xDelete<int>(cs_array);
 }
 
@@ -36,5 +36,5 @@
 
 	/*Copy current stiffness matrix*/
-	values=(double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));
+	values=xNew<double>(Ke->nrows*Ke->ncols);
 	for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j];
 
@@ -49,5 +49,5 @@
 
 	/*Free Matrix*/
-	xfree((void**)&transform);
-	xfree((void**)&values);
+	xDelete<double>(transform);
+	xDelete<double>(values);
 }
Index: /issm/trunk-jpl/src/c/shared/Elements/TransformStiffnessMatrixCoord.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Elements/TransformStiffnessMatrixCoord.cpp	(revision 12434)
+++ /issm/trunk-jpl/src/c/shared/Elements/TransformStiffnessMatrixCoord.cpp	(revision 12435)
@@ -9,5 +9,5 @@
 
 	/*All nodes have the same Coordinate System*/
-	cs_array=(int*)xmalloc(numnodes*sizeof(int));
+	cs_array=xNew<int>(numnodes);
 	for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum;
 
@@ -16,5 +16,5 @@
 
 	/*Clean-up*/
-	xfree((void**)&cs_array);
+	xDelete<int>(cs_array);
 }
 
@@ -36,5 +36,5 @@
 
 	/*Copy current stiffness matrix*/
-	values=(double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));
+	values=xNew<double>(Ke->nrows*Ke->ncols);
 	for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j];
 
@@ -49,5 +49,5 @@
 
 	/*Free Matrix*/
-	xfree((void**)&transform);
-	xfree((void**)&values);
+	xDelete<double>(transform);
+	xDelete<double>(values);
 }
Index: /issm/trunk-jpl/src/c/shared/Exp/DomainOutlineRead.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Exp/DomainOutlineRead.cpp	(revision 12434)
+++ /issm/trunk-jpl/src/c/shared/Exp/DomainOutlineRead.cpp	(revision 12435)
@@ -19,20 +19,20 @@
 
 	/*I/O: */
-	FILE* fid=NULL;
-	char chardummy[256];
+	FILE   *fid = NULL;
+	char    chardummy[256];
 	double  ddummy;
 
 	/*output: */
-	int nprof; //number of profiles in the domainname file
-	int* profnvertices=NULL; //array holding the number of vertices for the nprof profiles
-	double** pprofx=NULL; //array of profiles x coordinates
-	double** pprofy=NULL; //array of profiles y coordinates
-	bool* closed=NULL; //array holding closed flags for the nprof profiles
+	int      nprof;                //number of profiles in the domainname file
+	int     *profnvertices = NULL; //array holding the number of vertices for the nprof profiles
+	double **pprofx        = NULL; //array of profiles x coordinates
+	double **pprofy        = NULL; //array of profiles y coordinates
+	bool    *closed        = NULL; //array holding closed flags for the nprof profiles
 
 	/*For each profile: */
-	int n;
-	double* x=NULL;
-	double* y=NULL;
-	bool cl;
+	int     n;
+	double *x  = NULL;
+	double *y  = NULL;
+	bool    cl;
 
 	/*open domain outline file for reading: */
@@ -61,12 +61,12 @@
 	
 	/*Allocate and initialize all the profiles: */
-	profnvertices=(int*)xmalloc(nprof*sizeof(int));
-	pprofx=(double**)xmalloc(nprof*sizeof(double*));
-	pprofy=(double**)xmalloc(nprof*sizeof(double*));
+	profnvertices=xNew<int>(nprof);
+	pprofx=xNew<double*>(nprof);
+	pprofy=xNew<double*>(nprof);
 	for (i=0;i<nprof;i++){
 		pprofx[i]=NULL;
 		pprofy[i]=NULL;
 	}
-	closed=(bool*)xmalloc(nprof*sizeof(bool));
+	closed=xNew<bool>(nprof);
 
 	/*Reaset file pointer to beginning of file: */
@@ -91,5 +91,4 @@
 		y=(double*)xmalloc(n*sizeof(double));
 		
-
 		/*Read vertices: */
 		for (i=0;i<n;i++){
@@ -118,6 +117,8 @@
 	*ppprofx=pprofx;
 	*ppprofy=pprofy;
-	if(pclosed)*pclosed=closed;
-	else       xfree((void**)&closed);
+	if(pclosed)
+	 *pclosed=closed;
+	else
+	 xDelete<bool>(closed);
 }
 
Index: /issm/trunk-jpl/src/c/shared/Threads/LaunchThread.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Threads/LaunchThread.cpp	(revision 12434)
+++ /issm/trunk-jpl/src/c/shared/Threads/LaunchThread.cpp	(revision 12435)
@@ -20,5 +20,5 @@
 
 #include "./issm_threads.h"
-#include "../Alloc/alloc.h"
+#include "../Alloc/xNewDelete.h"
 #include "../Exceptions/exceptions.h"
 #include "../../include/include.h"
@@ -28,12 +28,11 @@
 	#ifdef _MULTITHREADING_
 	int i;
-	int* status=NULL;
-
-	pthread_t* threads=NULL;
-	pthread_handle* handles=NULL;
+	int            *status  = NULL;
+	pthread_t      *threads = NULL;
+	pthread_handle *handles = NULL;
 	
 	/*dynamically allocate: */
-	threads=(pthread_t*)xmalloc(num_threads*sizeof(pthread_t));
-	handles=(pthread_handle*)xmalloc(num_threads*sizeof(pthread_handle));
+	threads=xNew<pthread_t>(num_threads);
+	handles=xNew<pthread_handle>(num_threads);
 
 	for(i=0;i<num_threads;i++){
@@ -42,5 +41,4 @@
 		handles[i].num=num_threads;
 	}
-	
 	for(i=0;i<num_threads;i++){
 
@@ -56,6 +54,6 @@
 	
 	/*Free ressources:*/
-	xfree((void**)&threads);
-	xfree((void**)&handles);
+	xDelete<pthread_t>(threads);
+	xDelete<pthread_handle>(handles);
 
 	#else
Index: /issm/trunk-jpl/src/c/shared/shared.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/shared.h	(revision 12434)
+++ /issm/trunk-jpl/src/c/shared/shared.h	(revision 12435)
@@ -17,5 +17,4 @@
 #include "Matrix/matrix.h"
 #include "Numerics/numerics.h"
-#include "Dofs/dofs.h"
 #include "Threads/issm_threads.h"
 #include "Bamg/shared.h"
