Fix irallocx_prof_sample().

Fix irallocx_prof_sample() to always allocate large regions, even when
alignment is non-zero.
This commit is contained in:
Jason Evans 2015-09-17 10:17:55 -07:00
parent 38e2c8fa9c
commit 4be9c79f88
2 changed files with 7 additions and 5 deletions

View File

@ -10,6 +10,8 @@ brevity. Much more detail can be found in the git revision history:
- Fix ixallocx_prof_sample() to never modify nor create sampled small
allocations. xallocx() is in general incapable of moving small allocations,
so this fix removes buggy code without loss of generality.
- Fix irallocx_prof_sample() to always allocate large regions, even when
alignment is non-zero.
* 4.0.1 (September 15, 2015)

View File

@ -2098,8 +2098,8 @@ label_oom:
}
static void *
irallocx_prof_sample(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t size,
size_t alignment, size_t usize, bool zero, tcache_t *tcache, arena_t *arena,
irallocx_prof_sample(tsd_t *tsd, void *old_ptr, size_t old_usize,
size_t usize, size_t alignment, bool zero, tcache_t *tcache, arena_t *arena,
prof_tctx_t *tctx)
{
void *p;
@ -2113,7 +2113,7 @@ irallocx_prof_sample(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t size,
return (NULL);
arena_prof_promoted(p, usize);
} else {
p = iralloct(tsd, old_ptr, old_usize, size, alignment, zero,
p = iralloct(tsd, old_ptr, old_usize, usize, alignment, zero,
tcache, arena);
}
@ -2133,8 +2133,8 @@ irallocx_prof(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t size,
old_tctx = prof_tctx_get(old_ptr);
tctx = prof_alloc_prep(tsd, *usize, prof_active, true);
if (unlikely((uintptr_t)tctx != (uintptr_t)1U)) {
p = irallocx_prof_sample(tsd, old_ptr, old_usize, size,
alignment, *usize, zero, tcache, arena, tctx);
p = irallocx_prof_sample(tsd, old_ptr, old_usize, *usize,
alignment, zero, tcache, arena, tctx);
} else {
p = iralloct(tsd, old_ptr, old_usize, size, alignment, zero,
tcache, arena);