summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-04-18 12:36:57 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-04-18 12:36:57 (GMT)
commitb68321b2b3647b23b0820d958ec529c13be121ed (patch)
treec7aa1de56ea21f15fbf9cc2d47a27cf445dc23d7
parent03e579f2010a79ac72e5f62a9e4531cabc33813e (diff)
parente217bd113db96b96b485de82395688ca2313918a (diff)
downloadhdf5-b68321b2b3647b23b0820d958ec529c13be121ed.zip
hdf5-b68321b2b3647b23b0820d958ec529c13be121ed.tar.gz
hdf5-b68321b2b3647b23b0820d958ec529c13be121ed.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'e217bd113db96b96b485de82395688ca2313918a': Resolve memory leak of last API context, by freeing it in H5CX terminate routine. Revert "Close memory leak of last API context when shutting library down."
-rw-r--r--src/H5.c3
-rw-r--r--src/H5CX.c75
-rw-r--r--src/H5CXprivate.h1
3 files changed, 26 insertions, 53 deletions
diff --git a/src/H5.c b/src/H5.c
index 1467ddf..552330d 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -415,8 +415,7 @@ H5_term_library(void)
/* Mark library as closed */
H5_INIT_GLOBAL = FALSE;
- /* Pop the API context (without checking for errors) */
- H5CX_pop_special();
+ /* Don't pop the API context (i.e. H5CX_pop), since it's been shut down already */
done:
#ifdef H5_HAVE_THREADSAFE
diff --git a/src/H5CX.c b/src/H5CX.c
index 5c907bc..c81a0f4 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -342,7 +342,7 @@ typedef struct H5CX_lapl_cache_t {
/********************/
static H5CX_node_t **H5CX__get_context(void);
static void H5CX__push_common(H5CX_node_t *cnode);
-static H5CX_node_t *H5CX__pop_common(hbool_t update_dxpl);
+static H5CX_node_t *H5CX__pop_common(void);
/*********************/
@@ -535,6 +535,16 @@ H5CX_term_package(void)
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5_PKG_INIT_VAR) {
+ H5CX_node_t *cnode; /* Context node */
+
+ /* Pop the top context node from the stack */
+ /* (Can't check for errors, as rest of library is shut down) */
+ cnode = H5CX__pop_common();
+
+ /* Free the context node */
+ /* (Allocated with HDmalloc() in H5CX_push_special() ) */
+ HDfree(cnode);
+
#ifndef H5_HAVE_THREADSAFE
/* Release pointer to head of API context stack */
HDfree(H5CX_head_g);
@@ -2743,7 +2753,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5CX_node_t *
-H5CX__pop_common(hbool_t update_dxpl)
+H5CX__pop_common(void)
{
H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
H5CX_node_t *ret_value = NULL; /* Return value */
@@ -2753,25 +2763,22 @@ H5CX__pop_common(hbool_t update_dxpl)
/* Sanity check */
HDassert(head && *head);
- /* Update DXPL properties, if requested */
- if(update_dxpl) {
- /* Check for cached DXPL properties to return to application */
- H5CX_SET_PROP(H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, dcr_filters)
+ /* Check for cached DXPL properties to return to application */
+ H5CX_SET_PROP(H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, dcr_filters)
#ifdef H5_HAVE_PARALLEL
- H5CX_SET_PROP(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, mpio_actual_chunk_opt)
- H5CX_SET_PROP(H5D_MPIO_ACTUAL_IO_MODE_NAME, mpio_actual_io_mode)
- H5CX_SET_PROP(H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, mpio_local_no_coll_cause)
- H5CX_SET_PROP(H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, mpio_global_no_coll_cause)
+ H5CX_SET_PROP(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, mpio_actual_chunk_opt)
+ H5CX_SET_PROP(H5D_MPIO_ACTUAL_IO_MODE_NAME, mpio_actual_io_mode)
+ H5CX_SET_PROP(H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, mpio_local_no_coll_cause)
+ H5CX_SET_PROP(H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, mpio_global_no_coll_cause)
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
- H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, mpio_coll_chunk_link_hard)
- H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, mpio_coll_chunk_multi_hard)
- H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, mpio_coll_chunk_link_num_true)
- H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, mpio_coll_chunk_link_num_false)
- H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, mpio_coll_chunk_multi_ratio_coll)
- H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, mpio_coll_chunk_multi_ratio_ind)
+ H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, mpio_coll_chunk_link_hard)
+ H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, mpio_coll_chunk_multi_hard)
+ H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, mpio_coll_chunk_link_num_true)
+ H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, mpio_coll_chunk_link_num_false)
+ H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, mpio_coll_chunk_multi_ratio_coll)
+ H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, mpio_coll_chunk_multi_ratio_ind)
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
- } /* end if */
/* Pop the top context node from the stack */
ret_value = (*head);
@@ -2803,7 +2810,7 @@ H5CX_pop(void)
FUNC_ENTER_NOAPI(FAIL)
/* Perform common operations and get top context from stack */
- if(NULL == (cnode = H5CX__pop_common(TRUE)))
+ if(NULL == (cnode = H5CX__pop_common()))
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error getting API context node")
/* Free the context node */
@@ -2813,35 +2820,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_pop() */
-
-/*-------------------------------------------------------------------------
- * Function: H5CX_pop_special
- *
- * Purpose: Pops the context for an API call, without using library routines.
- *
- * Note: This should only be called in special circumstances, like H5close.
- *
- * Return: <none>
- *
- * Programmer: Quincey Koziol
- * Februrary 22, 2018
- *
- *-------------------------------------------------------------------------
- */
-void
-H5CX_pop_special(void)
-{
- H5CX_node_t *cnode; /* Context node */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Perform common operations and get top context from stack */
- cnode = H5CX__pop_common(FALSE);
- HDassert(cnode);
-
- /* Free the context node */
- HDfree(cnode);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5CX_pop_special() */
-
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 78f4793..3566f11 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -56,7 +56,6 @@ H5_DLL herr_t H5CX_pop(void);
#endif /* _H5private_H */
H5_DLL void H5CX_push_special(void);
H5_DLL hbool_t H5CX_is_def_dxpl(void);
-H5_DLL void H5CX_pop_special(void);
/* "Setter" routines for API context info */
H5_DLL void H5CX_set_dxpl(hid_t dxpl_id);