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.