From 39e7fd0580a140912fa1170de7a7699c86afe45d Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Mon, 25 Nov 2013 18:02:35 -0800 Subject: [PATCH] Fix ALLOCM_ARENA(a) handling in rallocm(). Fix rallocm() to use the specified arena for allocation, not just deallocation. Clarify ALLOCM_ARENA(a) documentation. --- doc/jemalloc.xml.in | 10 ++++++---- src/jemalloc.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in index 8837d343..596f6458 100644 --- a/doc/jemalloc.xml.in +++ b/doc/jemalloc.xml.in @@ -358,7 +358,7 @@ for (i = 0; i < nbins; i++) { Initialize newly allocated memory to contain zero bytes. In the growing reallocation case, the real size prior to reallocation defines the boundary between untouched bytes and those - that are initialized to contain zero bytes. If this option is + that are initialized to contain zero bytes. If this macro is absent, newly allocated memory is uninitialized. @@ -373,9 +373,11 @@ for (i = 0; i < nbins; i++) { Use the arena specified by the index - a. This macro does not validate that - a specifies an arena in the valid - range. + a (and by necessity bypass the thread + cache). This macro has no effect for huge regions, nor for regions + that were allocated via an arena other than the one specified. + This macro does not validate that a + specifies an arena index in the valid range. diff --git a/src/jemalloc.c b/src/jemalloc.c index 972f4546..491ec324 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -1530,7 +1530,7 @@ je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags) if (arena_ind != UINT_MAX) { arena_chunk_t *chunk; - try_tcache_alloc = true; + try_tcache_alloc = false; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(*ptr); try_tcache_dalloc = (chunk == *ptr || chunk->arena != arenas[arena_ind]);