libmemalloc  v3.0.00
Modern Memory Allocator
Loading...
Searching...
No Matches
memalloc_utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ALIGN(val_)   (((val_) + (ARCH_ALIGNMENT - 1U)) & ~(ARCH_ALIGNMENT - 1U))
 Aligns a given value to the nearest memory boundary.
 
#define PTR_ERR(ptr_)   ((void *)((intptr_t)(ptr_)))
 Encodes a negative error code as an error pointer.
 
#define __LIBMEMALLOC_API
 Defines the default visibility attribute for exported symbols.
 
#define __ALIGN
 Defines structure alignment and enforces the target byte order.
 
#define __UNUSED
 Marks a symbol as potentially unused.
 
#define __GC_HOT
 Marks garbage-collector functions as “hot” (performance critical).
 
#define __GC_COLD
 Marks garbage-collector functions as “cold” (infrequently used).
 
#define __LIBMEMALLOC_INTERNAL_MALLOC
 Annotates allocator functions that return newly allocated memory.
 
#define __LIBMEMALLOC_MALLOC
 Annotates allocator functions that return newly allocated memory.
 
#define __LIBMEMALLOC_REALLOC
 Annotates reallocator functions that may return a pointer to resized memory.
 
#define __LIBMEMALLOC_INTERNAL_REALLOC
 Annotates reallocator functions that may return a pointer to resized memory.
 
#define LIKELY(cond_)   (!!(cond_))
 Compiler hint for likely branch prediction.
 
#define UNLIKELY(cond_)   (!!(x))
 Compiler hint for unlikely branch prediction.
 
#define PREFETCH_R(addr_)   ((void)0)
 Read prefetch hint.
 
#define PREFETCH_W(addr_)   ((void)0)
 Write prefetch hint.
 
#define ASSUME_ALIGNED(ptr_, align_)   (align_)
 Tell the compiler the pointer has a fixed alignment.
 

Detailed Description

Provides architecture-aware alignment definitions, symbol visibility attributes, and compiler optimization hints used throughout libmemalloc. Ensures consistent alignment, attribute semantics, and performance annotations across multiple target architectures and toolchains.

Version
v1.0.00
Date
29.09.2025
Author
Rafael V. Volkmer rafae.nosp@m.l.v..nosp@m.volkm.nosp@m.er@g.nosp@m.mail..nosp@m.com