summaryrefslogtreecommitdiffstats
path: root/src/H5MFaggr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5MFaggr.c')
-rw-r--r--src/H5MFaggr.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index f9bad97..c45b473 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -295,10 +295,26 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
if(H5MF_xfree(f, alloc_type, dxpl_id, aggr->addr, aggr->size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block")
- /* Point the aggregator at the newly allocated block */
- aggr->addr = new_space;
- aggr->size = aggr->alloc_size;
- aggr->tot_size = aggr->alloc_size;
+ /* If the block is not to be aligned, fold the eoa fragment
+ * into the newly allocated aggregator, as it could have
+ * been allocated in an aligned manner if the aggregator
+ * block is larger than the threshold */
+ if(eoa_frag_size && !alignment) {
+ HDassert(eoa_frag_addr + eoa_frag_size == new_space);
+ aggr->addr = eoa_frag_addr;
+ aggr->size = aggr->alloc_size + eoa_frag_size;
+ aggr->tot_size = aggr->size;
+
+ /* Reset EOA fragment */
+ eoa_frag_addr = HADDR_UNDEF;
+ eoa_frag_size = 0;
+ } /* end if */
+ else {
+ /* Point the aggregator at the newly allocated block */
+ aggr->addr = new_space;
+ aggr->size = aggr->alloc_size;
+ aggr->tot_size = aggr->alloc_size;
+ }
} /* end else */
/* Allocate space out of the metadata block */