-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Changes from all commits
c5e0561
4250e00
f4b47b2
e25ed9f
807bc81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -541,11 +541,6 @@ H5_term_library(void) | |
(void)H5MM_free(tmp_open_stream); | ||
} /* end while */ | ||
|
||
#if defined H5_MEMORY_ALLOC_SANITY_CHECK | ||
/* Sanity check memory allocations */ | ||
H5MM_final_sanity_check(); | ||
#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ | ||
|
||
/* Reset flag indicating that the library is being shut down */ | ||
H5_TERM_GLOBAL = FALSE; | ||
|
||
|
@@ -716,46 +711,6 @@ H5get_free_list_sizes(size_t *reg_size /*out*/, size_t *arr_size /*out*/, size_t | |
FUNC_LEAVE_API(ret_value) | ||
} /* end H5get_free_list_sizes() */ | ||
|
||
/*------------------------------------------------------------------------- | ||
* Function: H5get_alloc_stats | ||
* | ||
* Purpose: Gets the memory allocation statistics for the library, if the | ||
* --enable-memory-alloc-sanity-check option was given when building the | ||
* library. Applications can check whether this option was enabled by | ||
* detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This | ||
* option is enabled by default for debug builds of the library and | ||
* disabled by default for non-debug builds. If the option is not enabled, | ||
* all the values returned with be 0. These statistics are global for the | ||
* entire library, but don't include allocations from chunked dataset I/O | ||
* filters or non-native VOL connectors. | ||
* | ||
* Parameters: | ||
* H5_alloc_stats_t *stats; OUT: Memory allocation statistics | ||
* | ||
* Return: Success: non-negative | ||
* Failure: negative | ||
* | ||
* Programmer: Quincey Koziol | ||
* Saturday, March 7, 2020 | ||
* | ||
*------------------------------------------------------------------------- | ||
*/ | ||
herr_t | ||
H5get_alloc_stats(H5_alloc_stats_t *stats /*out*/) | ||
{ | ||
herr_t ret_value = SUCCEED; /* Return value */ | ||
|
||
FUNC_ENTER_API(FAIL) | ||
H5TRACE1("e", "x", stats); | ||
|
||
/* Call the internal allocation stat routine to get the values */ | ||
if (H5MM_get_alloc_stats(stats) < 0) | ||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get allocation stats") | ||
|
||
done: | ||
FUNC_LEAVE_API(ret_value) | ||
} /* end H5get_alloc_stats() */ | ||
|
||
/*------------------------------------------------------------------------- | ||
* Function: H5__debug_mask | ||
* | ||
|
@@ -1222,10 +1177,12 @@ H5allocate_memory(size_t size, hbool_t clear) | |
FUNC_ENTER_API_NOINIT | ||
H5TRACE2("*x", "zb", size, clear); | ||
|
||
if (clear) | ||
ret_value = H5MM_calloc(size); | ||
else | ||
ret_value = H5MM_malloc(size); | ||
if (size != 0) { | ||
if (clear) | ||
ret_value = H5MM_calloc(size); | ||
else | ||
ret_value = H5MM_malloc(size); | ||
} | ||
|
||
FUNC_LEAVE_API_NOINIT(ret_value) | ||
} /* end H5allocate_memory() */ | ||
|
@@ -1262,7 +1219,10 @@ H5resize_memory(void *mem, size_t size) | |
FUNC_ENTER_API_NOINIT | ||
H5TRACE2("*x", "*xz", mem, size); | ||
|
||
ret_value = H5MM_realloc(mem, size); | ||
if (size != 0) | ||
ret_value = H5MM_realloc(mem, size); | ||
else if (mem) | ||
ret_value = H5MM_xfree(mem); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
FUNC_LEAVE_API_NOINIT(ret_value) | ||
} /* end H5resize_memory() */ | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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...