mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
chore: generalize CompactObject::AllocateMR (#2847)
* allow AllocateMR from args
This commit is contained in:
parent
1987d1af70
commit
0d91e0313d
2 changed files with 17 additions and 5 deletions
|
@ -710,8 +710,7 @@ void CompactObj::SetJson(JsonType&& j) {
|
|||
u_.json_obj.json_ptr->swap(j);
|
||||
} else {
|
||||
SetMeta(JSON_TAG);
|
||||
void* ptr = tl.local_mr->allocate(sizeof(JsonType), alignof(JsonType));
|
||||
u_.json_obj.json_ptr = new (ptr) JsonType(std::move(j));
|
||||
u_.json_obj.json_ptr = AllocateMR<JsonType>(std::move(j));
|
||||
u_.json_obj.encoding = kEncodingJsonCons;
|
||||
}
|
||||
}
|
||||
|
@ -729,8 +728,7 @@ void CompactObj::SetSBF(uint64_t initial_capacity, double fp_prob, double grow_f
|
|||
*u_.sbf = SBF(initial_capacity, fp_prob, grow_factor, tl.local_mr);
|
||||
} else {
|
||||
SetMeta(SBF_TAG);
|
||||
void* ptr = tl.local_mr->allocate(sizeof(SBF), alignof(SBF));
|
||||
u_.sbf = new (ptr) SBF(initial_capacity, fp_prob, grow_factor, tl.local_mr);
|
||||
u_.sbf = AllocateMR<SBF>(initial_capacity, fp_prob, grow_factor, tl.local_mr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue