diff options
-rw-r--r-- | src/H5MF.c | 7 | ||||
-rw-r--r-- | src/H5MFaggr.c | 3 |
2 files changed, 8 insertions, 2 deletions
@@ -1200,8 +1200,11 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) HGOTO_DONE(SUCCEED) HDassert(addr != 0); /* Can't deallocate the superblock :-) */ - if (!f->shared->vfd_swmr_writer) { - // not a VFD SWMR writer, do not defer or process deferrals + if (!f->shared->vfd_swmr_writer || f->shared->closing || + alloc_type != H5FD_MEM_DRAW) { + /* VFD SWMR writers defer raw-data allocations until the + * file starts to close. + */ ret_value = H5MF__xfree_impl(f, alloc_type, addr, size); } else if (defer_free(f->shared, alloc_type, addr, size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "could not defer") diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index d716ae2..919ba63 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -753,6 +753,9 @@ H5MF_free_aggrs(H5F_t *f) HDassert(f->shared); HDassert(f->shared->lf); + if (f->shared->closing && H5MF_process_deferred_frees(f, UINT64_MAX) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "could not process deferrals") + /* Retrieve metadata aggregator info, if available */ if(H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") |