mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-01 23:54:12 +08:00
mdbx: fix mdbx_dpl_alloc()
.
Change-Id: Ia7d4b1866ca3623668edffd56ab83e845f16b2a5
This commit is contained in:
parent
0cebc50291
commit
dec11e639a
15
src/core.c
15
src/core.c
@ -3293,13 +3293,16 @@ static int mdbx_dpl_alloc(MDBX_txn *txn) {
|
||||
const int wanna = (txn->mt_env->me_options.dp_initial < txn->mt_geo.upper)
|
||||
? txn->mt_env->me_options.dp_initial
|
||||
: txn->mt_geo.upper;
|
||||
const int realloc_threshold = 64;
|
||||
if (!txn->tw.dirtylist ||
|
||||
(int)txn->tw.dirtylist->detent - wanna > realloc_threshold ||
|
||||
(int)txn->tw.dirtylist->detent - wanna < -realloc_threshold) {
|
||||
if (unlikely(!mdbx_dpl_reserve(txn, wanna)))
|
||||
return MDBX_ENOMEM;
|
||||
if (txn->tw.dirtylist) {
|
||||
mdbx_dpl_clear(txn->tw.dirtylist);
|
||||
const int realloc_threshold = 64;
|
||||
if (likely(
|
||||
!((int)(txn->tw.dirtylist->detent - wanna) > realloc_threshold ||
|
||||
(int)(txn->tw.dirtylist->detent - wanna) < -realloc_threshold)))
|
||||
return MDBX_SUCCESS;
|
||||
}
|
||||
if (unlikely(!mdbx_dpl_reserve(txn, wanna)))
|
||||
return MDBX_ENOMEM;
|
||||
mdbx_dpl_clear(txn->tw.dirtylist);
|
||||
return MDBX_SUCCESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user