summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-05-29 20:02:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-05-29 20:02:34 (GMT)
commitbdcbada3f282774f709e17990dc7f77b24919950 (patch)
treef2f1264f0a3c7ac08b78eb314358ce1ee62aa5a5 /src/H5FD.c
parent7b0fa3950e74ea0c9bfe3baa07a48e2d451ebab5 (diff)
downloadhdf5-bdcbada3f282774f709e17990dc7f77b24919950.zip
hdf5-bdcbada3f282774f709e17990dc7f77b24919950.tar.gz
hdf5-bdcbada3f282774f709e17990dc7f77b24919950.tar.bz2
[svn-r13814] Description:
Change back to clearing memory buffers by default, but give users option to disable this, for performance reasons (--disable-clear-file-buffers). Also, add configure option (--enable-using-memchecker) to conveniently control making the library "play nice" with memory checking tools like valgrind and purify. Tested on: Mac OS X/32 10.4.9 (amazon) FreeBSD/32 6.2 (duty) Linux/32 2.6 (kagiso)
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index 8dd72cd..198757b 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -3491,9 +3491,9 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* Reallocate the metadata accumulator buffer */
if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+HDmemset(file->meta_accum + file->accum_size, 0, (file->accum_buf_size - (file->accum_size + size)));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Move the existing metadata to the proper location */
@@ -3519,9 +3519,9 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Reallocate the metadata accumulator buffer */
if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+HDmemset(file->meta_accum + file->accum_size + size, 0, (file->accum_buf_size - (file->accum_size + size)));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Copy the new metadata to the end */
@@ -3554,9 +3554,9 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Reallocate the metadata accumulator buffer */
if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+HDmemset(file->meta_accum + file->accum_size, 0, (file->accum_buf_size - file->accum_size));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Calculate the proper offset of the existing metadata */
@@ -3588,9 +3588,9 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Reallocate the metadata accumulator buffer */
if((file->meta_accum=H5FL_BLK_REALLOC(meta_accum,file->meta_accum,file->accum_buf_size))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+HDmemset(file->meta_accum + file->accum_size, 0, (file->accum_buf_size - file->accum_size));
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
/* Copy the new metadata to the end */
@@ -3625,9 +3625,12 @@ HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_s
/* Note the new buffer size */
file->accum_buf_size=size;
-#ifdef H5_USING_PURIFY
-HDmemset(file->meta_accum+file->accum_size,0,(file->accum_buf_size-file->accum_size));
-#endif /* H5_USING_PURIFY */
+#ifdef H5_CLEAR_MEMORY
+{
+size_t clear_size = MAX(file->accum_size, size);
+HDmemset(file->meta_accum + clear_size, 0, (file->accum_buf_size - clear_size));
+}
+#endif /* H5_CLEAR_MEMORY */
} /* end if */
else {
/* Check if we should shrink the accumulator buffer */