More allocation fixes for NUMA allocator.
authorSander Pronk <pronk@cbr.su.se>
Thu, 10 Mar 2011 16:30:39 +0000 (17:30 +0100)
committerSander Pronk <pronk@cbr.su.se>
Thu, 10 Mar 2011 16:30:39 +0000 (17:30 +0100)
src/gmxlib/strdb.c
src/gmxlib/thread_mpi/impl.h
src/gmxlib/thread_mpi/tmpi_init.c
src/mdlib/mdebin.c

index d50fba7f38ca3f2d32f7872800687a20e49d1ba7..91a9ef713ea2dd4ca275934d4926112856825a94 100644 (file)
@@ -160,7 +160,7 @@ int fget_lines(FILE *in,char ***strings)
   snew(ptr,nstr);
   for(i=0; (i<nstr); i++) {
     fgets2(buf,255,in);
-    ptr[i] = strdup(buf);
+    ptr[i] = gmx_strdup(buf);
   }
   
   (*strings) = ptr;
index 4d3a03b2cef6733e78fad79da5ee14c8b6c5c3a3..609b15b7f369767faf23869d0bd811874e8f97c7 100644 (file)
@@ -687,9 +687,16 @@ extern struct tmpi_global *tmpi_global;
 void tMPI_Trace_print(const char *fmt, ...);
 #endif
 
-/* error-checking malloc/realloc: */
+/* error-checking malloc/realloc/free: */
 void *tMPI_Malloc(size_t size);
 void *tMPI_Realloc(void *p, size_t size);
+void tMPI_Free(void *p);
+
+/*
+//use the following instead of the above function definition for debugging mis- matched allocate/free calls.
+#include <smalloc.h>
+#define tMPI_Free(a) sfree(a)
+*/
 
 
 /* get the current thread structure pointer */
index 97495326e98fbbb7bf2b4f0e5c62e075134ccfb8..01dd676537bc127d1e63935b0c0fbf82e35529a7 100644 (file)
@@ -159,6 +159,11 @@ void *tMPI_Realloc(void *p, size_t size)
     return ret;
 }
 
+void tMPI_Free(void *p)
+{
+    free(p);
+}
+
 
 #if 0
 struct tmpi_thread *tMPI_Get_current(void)
index f94bf4c79d180970bb14fdc88720e75c65c0b177..3bf5eaacb9582d1ebc0b4c7b202afb96a03ec22e 100644 (file)
@@ -610,12 +610,12 @@ FILE *open_dhdl(const char *filename,const t_inputrec *ir,
         if (ir->dhdl_derivatives == dhdlderivativesYES)
         {
             sprintf(buf,"%s %s %g",dhdl,lambda,ir->init_lambda);
-            setname[nsi++] = strdup(buf);
+            setname[nsi++] = gmx_strdup(buf);
         }
         for(s=0; s<ir->n_flambda; s++)
         {
             sprintf(buf,"%s %s %g",deltag,lambda,ir->flambda[s]);
-            setname[nsi++] = strdup(buf);
+            setname[nsi++] = gmx_strdup(buf);
         }
         xvgr_legend(fp,nsets,(const char**)setname,oenv);