diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-08-15 00:30:21 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-08-15 00:30:21 (GMT) |
commit | ad13ea65abf246f25841f1bb32ee232c1767b9df (patch) | |
tree | 0ced53d37b2689643234f6919cc5f101bc905081 /src/H5FD.c | |
parent | ef90db21a40b8892b79991ecb66b29b305e102de (diff) | |
download | hdf5-ad13ea65abf246f25841f1bb32ee232c1767b9df.zip hdf5-ad13ea65abf246f25841f1bb32ee232c1767b9df.tar.gz hdf5-ad13ea65abf246f25841f1bb32ee232c1767b9df.tar.bz2 |
[svn-r7367] Purpose:
Update
Description:
Added an extra flag to the clear functions that triggers a "destroy"
of the object being cleared if necessary. This is a fix for the
FPHDF5 stuff which had an object sticking around after it was
cleared. (In FPHDF5, some processes are in charge of destroying the
object, but all processes might actually allocate the object.)
Platforms tested:
AIX (Copper: Fortran & C++)
Linux (Verbena: Fortran & C++)
IRIX (Modi4: Parallel & Fortran)
(Sol is down)
Misc. update:
Diffstat (limited to 'src/H5FD.c')
-rw-r--r-- | src/H5FD.c | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -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: |