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

Remove memory sanity checks #2164

Closed
wants to merge 5 commits into from

Conversation

derobins
Copy link
Member

Also simplifies the H5MM package, replacing most H5MM replacement functions with defines to C standard library functions

Removed:
* The H5get_alloc_stats() API call
* The --enable-memory-alloc-sanity-check Autotools configure option
* The HDF5_MEMORY_ALLOC_SANITY_CHECK CMake option
@@ -55,13 +55,29 @@ New Features

(ADB - 2022/08/29, HDFFV-11329)

-
- Removed the --enable-memory-alloc-sanity-check Autotools configure option
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newer notes at top of section, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I thought...

if (size != 0)
ret_value = H5MM_realloc(mem, size);
else if (mem)
ret_value = H5MM_xfree(mem);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read here https://www.tutorialspoint.com/c_standard_library/c_function_realloc.htm, it said
size − This is the new size for the memory block, in bytes. If it is 0 and ptr points to an existing block of memory, the memory block pointed by ptr is deallocated and a NULL pointer is returned.
Do we need to use H5MM_xfree instead?

* Purpose: Just like free(3) except null pointers are allowed as
* arguments, and the return value (always NULL) can be
* assigned to the pointer whose memory was just freed:
* Purpose: Just like free(3) except the return value (always NULL) can
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is H5MM_xfree still needed? Do any supported systems fail if we remove it (could test by #define H5MM_xfree H5MM_free)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it gets mapped to just plain free then I think we still have several places in the library that would do mem = free which won't compile, so we'd need to update those. But I don't think it's really needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to convert H5MM_xfree to a macro:
#define H5MM_xfree(A) (H5MM_free(A), NULL)

@lrknox
Copy link
Collaborator

lrknox commented Oct 19, 2022

Test that failed was one of the dt_arith tests in the MacOS Clang CMake REL test configuration.
23: Testing hard normalized long double -> signed char conversions
...
22/2452 Test #23: H5TEST-dt_arith ............................................................***Failed 0.24 sec

There were also 75+ "Failed ..." messages in the same test configuration, mostly in h5repack (and h5dump) tests, but all of those tests passed.

@jhendersonHDF
Copy link
Collaborator

Test that failed was one of the dt_arith tests in the MacOS Clang CMake REL test configuration. 23: Testing hard normalized long double -> signed char conversions ... 22/2452 Test #23: H5TEST-dt_arith ............................................................***Failed 0.24 sec

There were also 75+ "Failed ..." messages in the same test configuration, mostly in h5repack (and h5dump) tests, but all of those tests passed.

This is the same test that fails in #1929. @derobins and I need to figure out what's going on there because it looks like we have a memory issue that's been hidden on MacOS for a long time.

@derobins
Copy link
Member Author

Need to investigate the long double conversion failures on MacOS

@derobins derobins closed this Oct 25, 2022
@derobins derobins deleted the remove_mem_sanity_checks branch March 27, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants