summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index 37e14e4..aa1935c 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -1313,9 +1313,9 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
* try to do the actual allocations.
*/
if (H5FD_is_fphdf5_driver(file) && !H5FD_fphdf5_is_sap(file)) {
- unsigned req_id;
+ unsigned req_id = 0;
unsigned capt_only = 0;
- H5FP_status_t status;
+ H5FP_status_t status = H5FP_STATUS_OK;
H5P_genplist_t *plist;
H5FP_alloc_t fp_alloc;
@@ -1325,8 +1325,9 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
if (H5P_exist_plist(plist, H5FD_FPHDF5_CAPTN_ALLOC_ONLY) > 0)
if (H5P_get(plist, H5FD_FPHDF5_CAPTN_ALLOC_ONLY, &capt_only) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, HADDR_UNDEF,
- "can't remove FPHDF5 property");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, HADDR_UNDEF, "can't retrieve FPHDF5 property");
+
+ HDmemset(&fp_alloc, 0, sizeof(fp_alloc));
/*
* If the captain is the only one who should allocate resources,
@@ -2081,6 +2082,27 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
assert(file->cls);
assert(type >= 0 && type < H5FD_MEM_NTYPES);
+#ifdef H5_HAVE_FPHDF5
+ /*
+ * When we're using the FPHDF5 driver, allocate from the SAP. If this
+ * is the SAP executing this code, then skip the send to the SAP and
+ * try to do the actual allocations.
+ */
+ if (H5FD_is_fphdf5_driver(file) && !H5FD_fphdf5_is_sap(file)) {
+ unsigned req_id;
+ H5FP_status_t status;
+
+ /* Send the request to the SAP */
+ if (H5FP_request_free(file, type, addr, size, &req_id, &status) != SUCCEED)
+ /* FIXME: Should we check the "status" variable here? */
+ HGOTO_ERROR(H5E_FPHDF5, H5E_CANTFREE, FAIL,
+ "server couldn't free from file");
+
+ /* We've succeeded -- return the value */
+ HGOTO_DONE(ret_value);
+ }
+#endif /* H5_HAVE_FPHDF5 */
+
if (!H5F_addr_defined(addr) || addr>file->maxaddr ||
H5F_addr_overflow(addr, size) || addr+size>file->maxaddr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid region");
@@ -2284,6 +2306,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed");
} else {
/* leak memory */
+HDfprintf(stderr, "%s: LEAKED MEMORY!!!!!!\n", FUNC);
}
done: