Fix extent_quantize() to handle greater-than-huge-size extents.
Allocation requests can't directly create extents that exceed
HUGE_MAXCLASS, but extent merging can create them.
This fixes a regression caused by
8a03cf039c
(Implement cache index
randomization for large allocations.) and first released in 4.0.0.
This resolves #497.
This commit is contained in:
parent
e916d55ba1
commit
2cdf07aba9
24
src/extent.c
24
src/extent.c
@ -3,15 +3,29 @@
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Round down to the nearest chunk size that can actually be requested during
|
||||||
|
* normal huge allocation.
|
||||||
|
*/
|
||||||
JEMALLOC_INLINE_C size_t
|
JEMALLOC_INLINE_C size_t
|
||||||
extent_quantize(size_t size)
|
extent_quantize(size_t size)
|
||||||
{
|
{
|
||||||
|
size_t ret;
|
||||||
|
szind_t ind;
|
||||||
|
|
||||||
/*
|
assert(size > 0);
|
||||||
* Round down to the nearest chunk size that can actually be requested
|
|
||||||
* during normal huge allocation.
|
ind = size2index(size + 1);
|
||||||
*/
|
if (ind == NSIZES) {
|
||||||
return (index2size(size2index(size + 1) - 1));
|
/*
|
||||||
|
* Allocation requests can't directly create extents that exceed
|
||||||
|
* HUGE_MAXCLASS, but extent merging can create them.
|
||||||
|
*/
|
||||||
|
return (HUGE_MAXCLASS);
|
||||||
|
}
|
||||||
|
ret = index2size(ind - 1);
|
||||||
|
assert(ret <= size);
|
||||||
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
JEMALLOC_INLINE_C int
|
JEMALLOC_INLINE_C int
|
||||||
|
Loading…
Reference in New Issue
Block a user