[mpich2-commits] r4103 - mpich2/trunk/src/util/mem
goodell at mcs.anl.gov
goodell at mcs.anl.gov
Tue Mar 17 17:01:08 CDT 2009
Author: goodell
Date: 2009-03-17 17:01:08 -0500 (Tue, 17 Mar 2009)
New Revision: 4103
Modified:
mpich2/trunk/src/util/mem/trmem.c
Log:
Fix for an incorrect valgrind warning in the memory allocation code.
No reviewer.
Modified: mpich2/trunk/src/util/mem/trmem.c
===================================================================
--- mpich2/trunk/src/util/mem/trmem.c 2009-03-17 19:28:26 UTC (rev 4102)
+++ mpich2/trunk/src/util/mem/trmem.c 2009-03-17 22:01:08 UTC (rev 4103)
@@ -436,8 +436,16 @@
*/
/* FIXME why do we skip the first few ints? [goodell@] */
nset = head->size - 2 * sizeof(int);
- if (nset > 0)
+ if (nset > 0) {
+#if defined(USE_VALGRIND_MACROS)
+ /* If an upper layer (like the handle allocation code) ever used the
+ VALGRIND_MAKE_MEM_NOACCESS macro on part/all of the data we gave
+ them then our memset will elicit "invalid write" errors from
+ valgrind. Mark it as accessible but undefined here to prevent this. */
+ VALGRIND_MAKE_MEM_UNDEFINED(ahead + 2 * sizeof(int), nset);
+#endif
memset( ahead + 2 * sizeof(int), TRFreedByte, nset );
+ }
free( a );
}
More information about the mpich2-commits
mailing list