Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak with HighFive::HDF5ErrMapper::ToException<HighFive::FileException> #479

Closed
emmenlau opened this issue Sep 16, 2021 · 2 comments · Fixed by #583
Closed

Memory leak with HighFive::HDF5ErrMapper::ToException<HighFive::FileException> #479

emmenlau opened this issue Sep 16, 2021 · 2 comments · Fixed by #583

Comments

@emmenlau
Copy link
Contributor

Describe the bug
We have started to run tests with address-sanitizer enabled, and there are reports of memory leaks in HighFive:

Direct leak of 213 byte(s) in 9 object(s) allocated from:
    #0 0x44461d in malloc (/data/Debug/BDAHDF5/FileTest+0x44461d)
    #1 0x7beac6 in H5MM_malloc /home/bdaci01/hdf5/src/H5MM.c:313:21
    #2 0x64c221 in H5Eget_major /home/bdaci01/hdf5/src/H5Edeprec.c:109:23
    #3 0x4b64e1 in int HighFive::HDF5ErrMapper::stackWalk<HighFive::FileException>(unsigned int, H5E_error2_t const*, void*) /data/Debug/include/highfive/bits/H5Exception_misc.hpp:27:33
    #4 0x64f06d in H5E__walk /home/bdaci01/hdf5/src/H5Eint.c:552:33
    #5 0x64a28b in H5Ewalk2 /home/bdaci01/hdf5/src/H5E.c:1519:22
    #6 0x4b59a5 in void HighFive::HDF5ErrMapper::ToException<HighFive::FileException>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /data/Debug/include/highfive/bits/H5Exception_misc.hpp:49:13
    #7 0x4b51ba in HighFive::File::File(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, HighFive::PropertyList<(HighFive::PropertyType)2> const&) /data/Debug/include/highfive/bits/H5File_misc.hpp:66:13
    #8 0x499b90 in std::_MakeUniq<HighFive::File>::__single_object std::make_unique<HighFive::File, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:962:34

This is not the only one, there may be others too.
To Reproduce
Compile and link with -fsanitize=address in gcc or clang.

@emmenlau
Copy link
Contributor Author

Is it possible to add address-sanitizer to the default HighFive tests? I think this could be quite valuable...

@alkino
Copy link
Member

alkino commented May 25, 2022

I rerun all tests with sanitizer and can found only this one.
Fixed in #583

robomics added a commit to robomics/coolerpp that referenced this issue Aug 1, 2022
HighFive v2.4.1 leaks memory every time an exception is thrown.
This is a known issue (BlueBrain/HighFive#479)
and has been fixed by this PR: BlueBrain/HighFive#583,
but the fix has not yet landed in a release.

Remember to revert this commit when HighFive v2.4.2 is released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants