mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 05:33:06 +00:00
mark huge allocations as unlikely
This cleans up the fast path a bit more by moving away more code.
This commit is contained in:
committed by
Jason Evans
parent
c93ed81cd0
commit
809b0ac391
@@ -264,7 +264,7 @@ a0alloc(size_t size, bool zero)
|
||||
if (size == 0)
|
||||
size = 1;
|
||||
|
||||
if (size <= arena_maxclass)
|
||||
if (likely(size <= arena_maxclass))
|
||||
ret = arena_malloc(NULL, a0get(), size, zero, false);
|
||||
else
|
||||
ret = huge_malloc(NULL, a0get(), size, zero, false);
|
||||
@@ -295,7 +295,7 @@ a0free(void *ptr)
|
||||
return;
|
||||
|
||||
chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
|
||||
if (chunk != ptr)
|
||||
if (likely(chunk != ptr))
|
||||
arena_dalloc(NULL, chunk, ptr, false);
|
||||
else
|
||||
huge_dalloc(NULL, ptr, false);
|
||||
|
||||
Reference in New Issue
Block a user