From c8dccc9bc41c4f1d5ce2a479d3afda5d7a95926b Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Thu, 11 Feb 2021 15:20:37 +0300 Subject: [PATCH] mdbx: limits the initial size of dpl-list to the current db-size. Change-Id: I5f575fc6168f50786b6f8a82ae020d323530a12e --- src/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index 046c2fd0..fb5822a7 100644 --- a/src/core.c +++ b/src/core.c @@ -3293,8 +3293,10 @@ static MDBX_dpl *mdbx_dpl_reserve(MDBX_txn *txn, size_t size) { static int mdbx_dpl_alloc(MDBX_txn *txn) { mdbx_tassert(txn, (txn->mt_flags & MDBX_TXN_RDONLY) == 0 && !txn->tw.dirtylist); - MDBX_dpl *const dl = - mdbx_dpl_reserve(txn, txn->mt_env->me_options.dp_initial); + const size_t len = (txn->mt_env->me_options.dp_initial < txn->mt_geo.upper) + ? txn->mt_env->me_options.dp_initial + : txn->mt_geo.upper; + MDBX_dpl *const dl = mdbx_dpl_reserve(txn, len); if (unlikely(!dl)) return MDBX_ENOMEM; mdbx_dpl_clear(dl);