valgrind complains

Hi,

I get the following valrgind (3.1.0) complaint:

==24788== Syscall param write(buf) points to uninitialised byte(s)
==24788== at 0x40007F2: (within /lib/ld-2.6.1.so)
==24788== by 0x434FC52: write (in /lib/i686/cmov/libc-2.6.1.so)
==24788== by 0x408E28B: H5FD_sec2_write
(in /home/domel/pack/i686/lib/libhdf5.so.0.0.0)
==24788== Address 0x4443170 is 440 bytes inside a block of size 1,864 alloc'd
==24788== at 0x4024765: malloc (vg_replace_malloc.c:149)
==24788== by 0x4092B6A: H5FL_malloc
(in /home/domel/pack/i686/lib/libhdf5.so.0.0.0)

On simply opening a file and closing it:

  hid_t file = H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
  herr_t status = H5Fclose(file);
  return 0;

I get a small memory leak on simply creating a group:

  hid_t group = H5Gcreate(file, gname.c_str(), 0);
  herr_t status = H5Gclose(group);

==24788== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 21 from 1)
==24788== malloc/free: in use at exit: 16 bytes in 2 blocks.
==24788== malloc/free: 1,115 allocs, 1,113 frees, 454,594 bytes allocated.
==24788== For counts of detected errors, rerun with: -v
==24788== searching for pointers to 2 not-freed blocks.
==24788== checked 133,708 bytes.

Does it have to do with problems with my hdf5-1.6.6 or system? I am using
linux debian/testing.

Thanks for any hints

regards,
Dominik

···

--
Dominik Szczerba, Ph.D.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Hi Dominik,

Hi,

I get the following valrgind (3.1.0) complaint:

==24788== Syscall param write(buf) points to uninitialised byte(s)
==24788== at 0x40007F2: (within /lib/ld-2.6.1.so)
==24788== by 0x434FC52: write (in /lib/i686/cmov/libc-2.6.1.so)
==24788== by 0x408E28B: H5FD_sec2_write
(in /home/domel/pack/i686/lib/libhdf5.so.0.0.0)
==24788== Address 0x4443170 is 440 bytes inside a block of size 1,864 alloc'd
==24788== at 0x4024765: malloc (vg_replace_malloc.c:149)
==24788== by 0x4092B6A: H5FL_malloc
(in /home/domel/pack/i686/lib/libhdf5.so.0.0.0)

On simply opening a file and closing it:

  hid_t file = H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
  herr_t status = H5Fclose(file);
  return 0;

I get a small memory leak on simply creating a group:

  hid_t group = H5Gcreate(file, gname.c_str(), 0);
  herr_t status = H5Gclose(group);

==24788== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 21 from 1)
==24788== malloc/free: in use at exit: 16 bytes in 2 blocks.
==24788== malloc/free: 1,115 allocs, 1,113 frees, 454,594 bytes allocated.
==24788== For counts of detected errors, rerun with: -v
==24788== searching for pointers to 2 not-freed blocks.
==24788== checked 133,708 bytes.

Does it have to do with problems with my hdf5-1.6.6 or system? I am using
linux debian/testing.

  The HDF5 library has internal free lists of memory structures, which can confuse memory allocation checking tools, like valgrind and Purify. Also, in the 1.6.x branch we were writing out "known empty, but unitialized" portions of memory, which memory checkers also whine about.

  If you are going to use a tool like valgrind or Purify, here's how to build the HDF5 distribution so that you don't get false memory leaks reported. For the 1.6.x branch, set the "H5_USING_PURIFY" preprocessor symbol to force memory to be initialized and to disable the internal free lists. If you just want to disable the internal free lists, you can define "H5_NO_FREE_LISTS". These symbols should be defined when building the HDF5 distribution, and I usually use something like this command to configure the library, which puts the preprocessor symbols in the compile line for the library:

env CFLAGS="-DH5_USING_PURIFY" path/to/configure <configure options>

  For the 1.8.0 branch, it's easier, there are two configure options that we added: --enable-using-memchecker turns off the internal free lists and --enable-clear-file-buffers forces memory to be initialized. Both of these are displayed in the "configure --help" output, if you want to refer to their descriptions there.

  So, try tuning the library for using the memory checker and then let me know if you are still seeing these sort of "leaks".

  Quincey

···

On Nov 24, 2007, at 11:12 AM, Dominik Szczerba wrote:

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

FYI I am using Insure++ on Linux with fairly good results

···

2007/11/27, Quincey Koziol <koziol@hdfgroup.org>:

Hi Dominik,

On Nov 24, 2007, at 11:12 AM, Dominik Szczerba wrote:

> Hi,
>
> I get the following valrgind (3.1.0) complaint:
>
> ==24788== Syscall param write(buf) points to uninitialised byte(s)
> ==24788== at 0x40007F2: (within /lib/ld-2.6.1.so)
> ==24788== by 0x434FC52: write (in /lib/i686/cmov/libc-2.6.1.so)
> ==24788== by 0x408E28B: H5FD_sec2_write
> (in /home/domel/pack/i686/lib/libhdf5.so.0.0.0)
> ==24788== Address 0x4443170 is 440 bytes inside a block of size
> 1,864 alloc'd
> ==24788== at 0x4024765: malloc (vg_replace_malloc.c:149)
> ==24788== by 0x4092B6A: H5FL_malloc
> (in /home/domel/pack/i686/lib/libhdf5.so.0.0.0)
>
> On simply opening a file and closing it:
>
> hid_t file = H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT,
> H5P_DEFAULT);
> herr_t status = H5Fclose(file);
> return 0;
>
> I get a small memory leak on simply creating a group:
>
> hid_t group = H5Gcreate(file, gname.c_str(), 0);
> herr_t status = H5Gclose(group);
>
> ==24788== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 21
> from 1)
> ==24788== malloc/free: in use at exit: 16 bytes in 2 blocks.
> ==24788== malloc/free: 1,115 allocs, 1,113 frees, 454,594 bytes
> allocated.
> ==24788== For counts of detected errors, rerun with: -v
> ==24788== searching for pointers to 2 not-freed blocks.
> ==24788== checked 133,708 bytes.
>
>
> Does it have to do with problems with my hdf5-1.6.6 or system? I am
> using
> linux debian/testing.

        The HDF5 library has internal free lists of memory structures,
which
can confuse memory allocation checking tools, like valgrind and
Purify. Also, in the 1.6.x branch we were writing out "known empty,
but unitialized" portions of memory, which memory checkers also whine
about.

        If you are going to use a tool like valgrind or Purify, here's how
to build the HDF5 distribution so that you don't get false memory
leaks reported. For the 1.6.x branch, set the "H5_USING_PURIFY"
preprocessor symbol to force memory to be initialized and to disable
the internal free lists. If you just want to disable the internal
free lists, you can define "H5_NO_FREE_LISTS". These symbols should
be defined when building the HDF5 distribution, and I usually use
something like this command to configure the library, which puts the
preprocessor symbols in the compile line for the library:

env CFLAGS="-DH5_USING_PURIFY" path/to/configure <configure options>

        For the 1.8.0 branch, it's easier, there are two configure options
that we added: --enable-using-memchecker turns off the internal free
lists and --enable-clear-file-buffers forces memory to be
initialized. Both of these are displayed in the "configure --help"
output, if you want to refer to their descriptions there.

        So, try tuning the library for using the memory checker and then
let
me know if you are still seeing these sort of "leaks".

        Quincey

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to
hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

--
What is the difference between mechanical engineers and civil engineers?
Mechanical engineers build weapons civil engineers build targets.