[PATCH] Avoid NULL check in je_free
jasone at canonware.com
Mon Apr 2 15:26:27 PDT 2012
On Apr 2, 2012, at 3:00 PM, Jason Evans wrote:
> On Apr 2, 2012, at 2:37 AM, Mike Hommey wrote:
>> From: Mike Hommey <mh at glandium.org>
>> The original patch from Igor Bukanov <igor at mir2.org>, in
>> https://bugzilla.mozilla.org/show_bug.cgi?id=571332, was also
>> modifying idalloc and arena_dalloc to avoid two CHUNK_ADDR2BASE
>> invocation, but since both functions are inlined, I doubt this
>> actually makes a difference.
>> include/jemalloc/internal/jemalloc_internal.h.in | 10 +++-------
>> src/jemalloc.c | 22 ++++++++++------------
>> 2 files changed, 13 insertions(+), 19 deletions(-)
> Applied, with some tweaks and additional tests.
> Unfortunately, I just realized that it introduces a bug due to overly strict assertions, but I'll get that fixed in a moment.
Actually, the patch is untenable because the thread_allocated_tsd_get() call in free() isn't safe until after initialization has occurred, and there's no cheaper way to assure initialized state than to check whether ptr is NULL. Oh well.
More information about the jemalloc-discuss