Hi Thomas,
Thank you for your report of the issue. It will be addressed in the next release. Binh-Minh ________________________________ From: Hdf-forum <[email protected]> on behalf of Thomas Krijnen <[email protected]> Sent: Monday, December 4, 2017 9:52 AM To: [email protected] Subject: [Hdf-forum] H5cpp resource leak Hi, I have observed the following code leaks resources linearly with program runtime (admittedly I checked only 1.8.19, but didn't see a reference to this in the .20 release notes). int main(int, char**) { H5::CompType ct((size_t)8); ct.insertMember("a", 0, H5::PredType::NATIVE_INT32); ct.insertMember("b", 4, H5::PredType::NATIVE_INT32); for (int i = 0; i < 100000; ++i) { H5::IntType dt = ct.getMemberIntType(0); std::cerr << dt.getSize(); // just some side effect in order not be optimized away (I doubt it would though) dt.close(); } } In my naive understanding this is due to the duplicate reference to p_get_member_type() in: IntType CompType::getMemberIntType(unsigned member_num) const { try { IntType inttype(p_get_member_type(member_num)); f_DataType_setId(&inttype, p_get_member_type(member_num)); return(inttype); } catch (DataTypeIException& E) { throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg()); } } This then results in two identifiers of which only one can be close()d. Note that this is not specific to integer member types. If one insists on using the C++ types, creating member types in the following fashion enabled me to close resources properly. H5::IntType dt(H5Tget_member_type(ct.getId(), 0)); std::cerr << dt.getSize(); H5Idec_ref(dt.getId()); dt.close(); Kind regards, Thomas
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org Twitter: https://twitter.com/hdf5
