diff options
author | Jason Evans <jasone@canonware.com> | 2015-06-24 01:47:07 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2015-06-24 01:56:14 (GMT) |
commit | 241abc601b947c5e0e56791bd73a924ce872b4a1 (patch) | |
tree | b0e16bf64ef20e317a2722874a6d1bd5688ebc12 /include | |
parent | 0a9f9a4d511e0c3343ff26e04d9592fefd96c2bc (diff) | |
download | jemalloc-241abc601b947c5e0e56791bd73a924ce872b4a1.zip jemalloc-241abc601b947c5e0e56791bd73a924ce872b4a1.tar.gz jemalloc-241abc601b947c5e0e56791bd73a924ce872b4a1.tar.bz2 |
Fix size class overflow handling when profiling is enabled.
Fix size class overflow handling for malloc(), posix_memalign(),
memalign(), calloc(), and realloc() when profiling is enabled.
Remove an assertion that erroneously caused arena_sdalloc() to fail when
profiling was enabled.
This resolves #232.
Diffstat (limited to 'include')
-rw-r--r-- | include/jemalloc/internal/arena.h | 1 | ||||
-rw-r--r-- | include/jemalloc/internal/jemalloc_internal.h.in | 11 |
2 files changed, 4 insertions, 8 deletions
diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h index 58d87cb..9990e45 100644 --- a/include/jemalloc/internal/arena.h +++ b/include/jemalloc/internal/arena.h @@ -1213,7 +1213,6 @@ arena_sdalloc(tsd_t *tsd, void *ptr, size_t size, tcache_t *tcache) * Make sure to use promoted size, not request * size. */ - assert(((uintptr_t)ptr & PAGE_MASK) == 0); size = arena_mapbits_large_size_get(chunk, pageind) - large_pad; } diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in index 0268245..ff9412a 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.in @@ -525,7 +525,7 @@ size2index_compute(size_t size) size_t lg_tmin = LG_TINY_MAXCLASS - NTBINS + 1; size_t lg_ceil = lg_floor(pow2_ceil(size)); return (lg_ceil < lg_tmin ? 0 : lg_ceil - lg_tmin); - } else + } #endif { size_t x = lg_floor((size<<1)-1); @@ -565,8 +565,7 @@ size2index(size_t size) assert(size > 0); if (likely(size <= LOOKUP_MAXCLASS)) return (size2index_lookup(size)); - else - return (size2index_compute(size)); + return (size2index_compute(size)); } JEMALLOC_INLINE size_t @@ -576,7 +575,6 @@ index2size_compute(index_t index) #if (NTBINS > 0) if (index < NTBINS) return (ZU(1) << (LG_TINY_MAXCLASS - NTBINS + 1 + index)); - else #endif { size_t reduced_index = index - NTBINS; @@ -623,7 +621,7 @@ s2u_compute(size_t size) size_t lg_ceil = lg_floor(pow2_ceil(size)); return (lg_ceil < lg_tmin ? (ZU(1) << lg_tmin) : (ZU(1) << lg_ceil)); - } else + } #endif { size_t x = lg_floor((size<<1)-1); @@ -656,8 +654,7 @@ s2u(size_t size) assert(size > 0); if (likely(size <= LOOKUP_MAXCLASS)) return (s2u_lookup(size)); - else - return (s2u_compute(size)); + return (s2u_compute(size)); } /* |