Memory Leaks in hdf-java

Through much pain, I've found the following memory leaks:

All of these leaks appear to still be valid in 2.5p3.

h5pImp.c: line 721 (Java_ncsa_hdf_hdf5lib_H5_H5Pset_1fill_1value).
byteP is never released. The fill value is leaked every time this method
is called.

h5sImp.c: line 403 (Java_ncsa_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims)
sa is never freed.

h5sImp.c: line 254 (Java_ncsa_hdf_hdf5lib_H5_H5Sselect_1elements)
lp should not be freed, it is incremented. llp should be freed.

exceptionImp.c: line 420 (h5libraryError)
it appears in hdf5 1.8.x, if msg is not free'd, a leak occurs on every
exception thrown. I haven't found documentation that indicates that this
should be freed, but it does solve the leak. A leak does not appear to
occur if linked against 1.6.x.

Let me know if I'm incorrect on any of these. Thanks.

Chris,

Thank you very much for your contribution. What you found is very helpful
to us.

Most of the memory leak you mentioned were fixed from our recent code.
The memory leak at exceptionImp.c is the one we missed. I think "msg" is the key
memory leak. I will run the memory leak test for 24 hours to see if the memory
still builds up.

Again, thank you very much for your help.
--pc

Christopher Hammack wrote:

···

Through much pain, I've found the following memory leaks:

All of these leaks appear to still be valid in 2.5p3.

h5pImp.c: line 721 (Java_ncsa_hdf_hdf5lib_H5_H5Pset_1fill_1value).
byteP is never released. The fill value is leaked every time this method
is called.

h5sImp.c: line 403 (Java_ncsa_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims)
sa is never freed.

h5sImp.c: line 254 (Java_ncsa_hdf_hdf5lib_H5_H5Sselect_1elements)
lp should not be freed, it is incremented. llp should be freed.

exceptionImp.c: line 420 (h5libraryError)
it appears in hdf5 1.8.x, if msg is not free'd, a leak occurs on every
exception thrown. I haven't found documentation that indicates that this
should be freed, but it does solve the leak. A leak does not appear to
occur if linked against 1.6.x.

Let me know if I'm incorrect on any of these. Thanks.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Chris,

I took a look at the HDF5 1.8 and 1.6 library source code.
in 1.6, H5Eget_minor(...) returns a string of static char array. Applications do not
need to free the memory.
in 1.8, H5Eget_minor(...) returns a string of dynamic allocated char array. Applications
have to free the memory.

Thanks
--pc

Christopher Hammack wrote:

···

Through much pain, I've found the following memory leaks:

All of these leaks appear to still be valid in 2.5p3.

h5pImp.c: line 721 (Java_ncsa_hdf_hdf5lib_H5_H5Pset_1fill_1value).
byteP is never released. The fill value is leaked every time this method
is called.

h5sImp.c: line 403 (Java_ncsa_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims)
sa is never freed.

h5sImp.c: line 254 (Java_ncsa_hdf_hdf5lib_H5_H5Sselect_1elements)
lp should not be freed, it is incremented. llp should be freed.

exceptionImp.c: line 420 (h5libraryError)
it appears in hdf5 1.8.x, if msg is not free'd, a leak occurs on every
exception thrown. I haven't found documentation that indicates that this
should be freed, but it does solve the leak. A leak does not appear to
occur if linked against 1.6.x.

Let me know if I'm incorrect on any of these. Thanks.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Is this latest version available somewhere in source code form? If you
have any other bugs fixed that I didn't find, I'd like to absorb those.
We're still seeing some memory growth that I have not been able to isolate
yet.

Thanks.

···

Chris,

Thank you very much for your contribution. What you found is very helpful
to us.

Most of the memory leak you mentioned were fixed from our recent code.
The memory leak at exceptionImp.c is the one we missed. I think "msg" is
the key
memory leak. I will run the memory leak test for 24 hours to see if the
memory
still builds up.

Again, thank you very much for your help.
--pc

Christopher Hammack wrote:
> Through much pain, I've found the following memory leaks:
>
> All of these leaks appear to still be valid in 2.5p3.
>
> h5pImp.c: line 721 (Java_ncsa_hdf_hdf5lib_H5_H5Pset_1fill_1value).
> byteP is never released. The fill value is leaked every time this
> method
> is called.
>

Chris,

You should be able to check out our recent source code from our subversion
repository at http://svn.hdfgroup.uiuc.edu/hdf-java/branches/hdf-java-2.6/

If not, I put a tarball at ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/hdf-java/v26b1/

The memory test has been running for a few hours and I did not see any memory leak
so far. I will leave the test running overnight to make sure there is no memory leak.

We also added a feature to the hdf-java wrapper to check if applications cause
any memory leak by checking H5.OPEN_IDS. It may be some potential memory
leak if your application leaves any open ids in the list (OPEN_IDS).

H5.OPEN_IDS will only detect memory leak in the Java code. It will not detect
memory leak in the JNI C code.
Thanks
--pc

Christopher Hammack wrote:

···

Is this latest version available somewhere in source code form? If you
have any other bugs fixed that I didn't find, I'd like to absorb those. We're still seeing some memory growth that I have not been able to isolate
yet.

Thanks.

Chris,

Thank you very much for your contribution. What you found is very helpful
to us.

Most of the memory leak you mentioned were fixed from our recent code.
The memory leak at exceptionImp.c is the one we missed. I think "msg" is
the key
memory leak. I will run the memory leak test for 24 hours to see if the
memory
still builds up.

Again, thank you very much for your help.
--pc

Christopher Hammack wrote:
    

Through much pain, I've found the following memory leaks:

All of these leaks appear to still be valid in 2.5p3.

h5pImp.c: line 721 (Java_ncsa_hdf_hdf5lib_H5_H5Pset_1fill_1value).
byteP is never released. The fill value is leaked every time this
method
is called.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org