TrinityCore
|
#include <math.h>
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include <sys/uio.h>
#include <pthread.h>
#include <errno.h>
#include <sys/types.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <inttypes.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
#include "jemalloc_defs.h"
#include "../jemalloc.h"
#include "jemalloc/internal/private_namespace.h"
#include "jemalloc/internal/rb.h"
#include "jemalloc/internal/qr.h"
#include "jemalloc/internal/ql.h"
#include "jemalloc/internal/util.h"
#include "jemalloc/internal/atomic.h"
#include "jemalloc/internal/prng.h"
#include "jemalloc/internal/ckh.h"
#include "jemalloc/internal/size_classes.h"
#include "jemalloc/internal/stats.h"
#include "jemalloc/internal/ctl.h"
#include "jemalloc/internal/mutex.h"
#include "jemalloc/internal/tsd.h"
#include "jemalloc/internal/mb.h"
#include "jemalloc/internal/extent.h"
#include "jemalloc/internal/arena.h"
#include "jemalloc/internal/bitmap.h"
#include "jemalloc/internal/base.h"
#include "jemalloc/internal/chunk.h"
#include "jemalloc/internal/huge.h"
#include "jemalloc/internal/rtree.h"
#include "jemalloc/internal/tcache.h"
#include "jemalloc/internal/hash.h"
#include "jemalloc/internal/quarantine.h"
#include "jemalloc/internal/prof.h"
Go to the source code of this file.
Classes | |
struct | thread_allocated_t |
Macros | |
#define | SIZE_T_MAX SIZE_MAX |
#define | offsetof(type, member) ((size_t)&(((type *)NULL)->member)) |
#define | JEMALLOC_NO_DEMANGLE |
#define | UNUSED |
#define | RB_COMPACT |
#define | JEMALLOC_H_TYPES |
#define | restrict |
#define | MALLOCX_LG_ALIGN_MASK ((int)0x3f) |
#define | ALLOCM_LG_ALIGN_MASK ((int)0x3f) |
#define | ZU(z) ((size_t)z) |
#define | QU(q) ((uint64_t)q) |
#define | __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) |
#define | JEMALLOC_ENABLE_INLINE |
#define | JEMALLOC_ALWAYS_INLINE static inline |
#define | JEMALLOC_ALWAYS_INLINE_C static inline |
#define | JEMALLOC_INLINE static inline |
#define | JEMALLOC_INLINE_C static inline |
#define | LG_TINY_MIN 3 |
#define | TINY_MIN (1U << LG_TINY_MIN) |
#define | QUANTUM ((size_t)(1U << LG_QUANTUM)) |
#define | QUANTUM_MASK (QUANTUM - 1) |
#define | QUANTUM_CEILING(a) (((a) + QUANTUM_MASK) & ~QUANTUM_MASK) |
#define | LONG ((size_t)(1U << LG_SIZEOF_LONG)) |
#define | LONG_MASK (LONG - 1) |
#define | LONG_CEILING(a) (((a) + LONG_MASK) & ~LONG_MASK) |
#define | SIZEOF_PTR (1U << LG_SIZEOF_PTR) |
#define | PTR_MASK (SIZEOF_PTR - 1) |
#define | PTR_CEILING(a) (((a) + PTR_MASK) & ~PTR_MASK) |
#define | LG_CACHELINE 6 |
#define | CACHELINE 64 |
#define | CACHELINE_MASK (CACHELINE - 1) |
#define | CACHELINE_CEILING(s) (((s) + CACHELINE_MASK) & ~CACHELINE_MASK) |
#define | LG_PAGE STATIC_PAGE_SHIFT |
#define | PAGE ((size_t)(1U << STATIC_PAGE_SHIFT)) |
#define | PAGE_MASK ((size_t)(PAGE - 1)) |
#define | PAGE_CEILING(s) (((s) + PAGE_MASK) & ~PAGE_MASK) |
#define | ALIGNMENT_ADDR2BASE(a, alignment) ((void *)((uintptr_t)(a) & (-(alignment)))) |
#define | ALIGNMENT_ADDR2OFFSET(a, alignment) ((size_t)((uintptr_t)(a) & (alignment - 1))) |
#define | ALIGNMENT_CEILING(s, alignment) (((s) + (alignment - 1)) & (-(alignment))) |
#define | VARIABLE_ARRAY(type, name, count) type *name = alloca(sizeof(type) * count) |
#define | RUNNING_ON_VALGRIND ((unsigned)0) |
#define | VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) do {} while (0) |
#define | VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB) do {} while (0) |
#define | VALGRIND_FREELIKE_BLOCK(addr, rzB) do {} while (0) |
#define | VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr, _qzz_len) do {} while (0) |
#define | VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr, _qzz_len) do {} while (0) |
#define | VALGRIND_MAKE_MEM_DEFINED(_qzz_addr, _qzz_len) do {} while (0) |
#define | JEMALLOC_VALGRIND_MALLOC(cond, ptr, usize, zero) do {} while (0) |
#define | JEMALLOC_VALGRIND_REALLOC(ptr, usize, old_ptr, old_usize, old_rzsize, zero) do {} while (0) |
#define | JEMALLOC_VALGRIND_FREE(ptr, rzsize) do {} while (0) |
#define | JEMALLOC_H_STRUCTS |
#define | THREAD_ALLOCATED_INITIALIZER JEMALLOC_ARG_CONCAT({0, 0}) |
#define | JEMALLOC_H_EXTERNS |
#define | JEMALLOC_H_INLINES |
#define | JEMALLOC_ARENA_INLINE_A |
#define | JEMALLOC_ARENA_INLINE_B |
Functions | |
arena_t * | arenas_extend (unsigned ind) |
void | arenas_cleanup (void *arg) |
arena_t * | choose_arena_hard (void) |
void | jemalloc_prefork (void) |
void | jemalloc_postfork_parent (void) |
void | jemalloc_postfork_child (void) |
malloc_tsd_externs (arenas, arena_t *) malloc_tsd_funcs(JEMALLOC_ALWAYS_INLINE | |
arena_t arenas_cleanup JEMALLOC_ALWAYS_INLINE size_t | s2u (size_t size) |
JEMALLOC_ALWAYS_INLINE size_t | sa2u (size_t size, size_t alignment) |
JEMALLOC_INLINE unsigned | narenas_total_get (void) |
JEMALLOC_INLINE arena_t * | choose_arena (arena_t *arena) |
JEMALLOC_ALWAYS_INLINE void * | imalloct (size_t size, bool try_tcache, arena_t *arena) |
JEMALLOC_ALWAYS_INLINE void * | imalloc (size_t size) |
JEMALLOC_ALWAYS_INLINE void * | icalloct (size_t size, bool try_tcache, arena_t *arena) |
JEMALLOC_ALWAYS_INLINE void * | icalloc (size_t size) |
JEMALLOC_ALWAYS_INLINE void * | ipalloct (size_t usize, size_t alignment, bool zero, bool try_tcache, arena_t *arena) |
JEMALLOC_ALWAYS_INLINE void * | ipalloc (size_t usize, size_t alignment, bool zero) |
JEMALLOC_ALWAYS_INLINE size_t | isalloc (const void *ptr, bool demote) |
JEMALLOC_ALWAYS_INLINE size_t | ivsalloc (const void *ptr, bool demote) |
JEMALLOC_INLINE size_t | u2rz (size_t usize) |
JEMALLOC_INLINE size_t | p2rz (const void *ptr) |
JEMALLOC_ALWAYS_INLINE void | idalloct (void *ptr, bool try_tcache) |
JEMALLOC_ALWAYS_INLINE void | idalloc (void *ptr) |
JEMALLOC_ALWAYS_INLINE void | iqalloct (void *ptr, bool try_tcache) |
JEMALLOC_ALWAYS_INLINE void | iqalloc (void *ptr) |
JEMALLOC_ALWAYS_INLINE void * | iralloct_realign (void *ptr, size_t oldsize, size_t size, size_t extra, size_t alignment, bool zero, bool try_tcache_alloc, bool try_tcache_dalloc, arena_t *arena) |
JEMALLOC_ALWAYS_INLINE void * | iralloct (void *ptr, size_t size, size_t extra, size_t alignment, bool zero, bool try_tcache_alloc, bool try_tcache_dalloc, arena_t *arena) |
JEMALLOC_ALWAYS_INLINE void * | iralloc (void *ptr, size_t size, size_t extra, size_t alignment, bool zero) |
JEMALLOC_ALWAYS_INLINE bool | ixalloc (void *ptr, size_t size, size_t extra, size_t alignment, bool zero) |
malloc_tsd_externs (thread_allocated, thread_allocated_t) malloc_tsd_funcs(JEMALLOC_ALWAYS_INLINE | |
Variables | |
static const bool | config_debug |
static const bool | config_dss |
static const bool | config_fill |
static const bool | config_lazy_lock |
static const bool | config_prof |
static const bool | config_prof_libgcc |
static const bool | config_prof_libunwind |
static const bool | config_mremap |
static const bool | config_munmap |
static const bool | config_stats |
static const bool | config_tcache |
static const bool | config_tls |
static const bool | config_utrace |
static const bool | config_valgrind |
static const bool | config_xmalloc |
static const bool | config_ivsalloc |
bool | opt_abort |
bool | opt_junk |
size_t | opt_quarantine |
bool | opt_redzone |
bool | opt_utrace |
bool | opt_valgrind |
bool | opt_xmalloc |
bool | opt_zero |
size_t | opt_narenas |
unsigned | ncpus |
malloc_mutex_t | arenas_lock |
arena_t ** | arenas |
unsigned | narenas_total |
unsigned | narenas_auto |
arena_t | NULL |
thread_allocated | |
thread_allocated_t | |
THREAD_ALLOCATED_INITIALIZER | |
#define ALIGNMENT_ADDR2BASE | ( | a, | |
alignment | |||
) | ((void *)((uintptr_t)(a) & (-(alignment)))) |
#define ALIGNMENT_ADDR2OFFSET | ( | a, | |
alignment | |||
) | ((size_t)((uintptr_t)(a) & (alignment - 1))) |
#define ALIGNMENT_CEILING | ( | s, | |
alignment | |||
) | (((s) + (alignment - 1)) & (-(alignment))) |
#define ALLOCM_LG_ALIGN_MASK ((int)0x3f) |
#define CACHELINE 64 |
#define CACHELINE_CEILING | ( | s | ) | (((s) + CACHELINE_MASK) & ~CACHELINE_MASK) |
#define CACHELINE_MASK (CACHELINE - 1) |
#define JEMALLOC_ALWAYS_INLINE static inline |
#define JEMALLOC_ALWAYS_INLINE_C static inline |
#define JEMALLOC_ARENA_INLINE_A |
#define JEMALLOC_ARENA_INLINE_B |
#define JEMALLOC_ENABLE_INLINE |
#define JEMALLOC_H_EXTERNS |
#define JEMALLOC_H_INLINES |
#define JEMALLOC_H_STRUCTS |
#define JEMALLOC_H_TYPES |
#define JEMALLOC_INLINE static inline |
#define JEMALLOC_INLINE_C static inline |
#define JEMALLOC_NO_DEMANGLE |
#define JEMALLOC_VALGRIND_FREE | ( | ptr, | |
rzsize | |||
) | do {} while (0) |
#define JEMALLOC_VALGRIND_MALLOC | ( | cond, | |
ptr, | |||
usize, | |||
zero | |||
) | do {} while (0) |
#define JEMALLOC_VALGRIND_REALLOC | ( | ptr, | |
usize, | |||
old_ptr, | |||
old_usize, | |||
old_rzsize, | |||
zero | |||
) | do {} while (0) |
#define LG_CACHELINE 6 |
#define LG_PAGE STATIC_PAGE_SHIFT |
#define LG_TINY_MIN 3 |
#define LONG ((size_t)(1U << LG_SIZEOF_LONG)) |
#define LONG_MASK (LONG - 1) |
#define MALLOCX_LG_ALIGN_MASK ((int)0x3f) |
#define offsetof | ( | type, | |
member | |||
) | ((size_t)&(((type *)NULL)->member)) |
#define PAGE ((size_t)(1U << STATIC_PAGE_SHIFT)) |
#define PAGE_MASK ((size_t)(PAGE - 1)) |
#define PTR_MASK (SIZEOF_PTR - 1) |
#define QU | ( | q | ) | ((uint64_t)q) |
#define QUANTUM ((size_t)(1U << LG_QUANTUM)) |
#define QUANTUM_CEILING | ( | a | ) | (((a) + QUANTUM_MASK) & ~QUANTUM_MASK) |
#define QUANTUM_MASK (QUANTUM - 1) |
#define RB_COMPACT |
#define restrict |
#define RUNNING_ON_VALGRIND ((unsigned)0) |
#define SIZE_T_MAX SIZE_MAX |
#define SIZEOF_PTR (1U << LG_SIZEOF_PTR) |
#define THREAD_ALLOCATED_INITIALIZER JEMALLOC_ARG_CONCAT({0, 0}) |
#define TINY_MIN (1U << LG_TINY_MIN) |
#define UNUSED |
#define VALGRIND_FREELIKE_BLOCK | ( | addr, | |
rzB | |||
) | do {} while (0) |
#define VALGRIND_MAKE_MEM_DEFINED | ( | _qzz_addr, | |
_qzz_len | |||
) | do {} while (0) |
#define VALGRIND_MAKE_MEM_NOACCESS | ( | _qzz_addr, | |
_qzz_len | |||
) | do {} while (0) |
#define VALGRIND_MAKE_MEM_UNDEFINED | ( | _qzz_addr, | |
_qzz_len | |||
) | do {} while (0) |
#define VALGRIND_MALLOCLIKE_BLOCK | ( | addr, | |
sizeB, | |||
rzB, | |||
is_zeroed | |||
) | do {} while (0) |
#define VALGRIND_RESIZEINPLACE_BLOCK | ( | addr, | |
oldSizeB, | |||
newSizeB, | |||
rzB | |||
) | do {} while (0) |
#define VARIABLE_ARRAY | ( | type, | |
name, | |||
count | |||
) | type *name = alloca(sizeof(type) * count) |
#define ZU | ( | z | ) | ((size_t)z) |
void arenas_cleanup | ( | void * | arg | ) |
arena_t* arenas_extend | ( | unsigned | ind | ) |
JEMALLOC_INLINE arena_t* choose_arena | ( | arena_t * | arena | ) |
arena_t* choose_arena_hard | ( | void | ) |
JEMALLOC_ALWAYS_INLINE void* icalloc | ( | size_t | size | ) |
JEMALLOC_ALWAYS_INLINE void* icalloct | ( | size_t | size, |
bool | try_tcache, | ||
arena_t * | arena | ||
) |
JEMALLOC_ALWAYS_INLINE void idalloc | ( | void * | ptr | ) |
JEMALLOC_ALWAYS_INLINE void idalloct | ( | void * | ptr, |
bool | try_tcache | ||
) |
JEMALLOC_ALWAYS_INLINE void* imalloc | ( | size_t | size | ) |
JEMALLOC_ALWAYS_INLINE void* imalloct | ( | size_t | size, |
bool | try_tcache, | ||
arena_t * | arena | ||
) |
JEMALLOC_ALWAYS_INLINE void* ipalloc | ( | size_t | usize, |
size_t | alignment, | ||
bool | zero | ||
) |
JEMALLOC_ALWAYS_INLINE void* ipalloct | ( | size_t | usize, |
size_t | alignment, | ||
bool | zero, | ||
bool | try_tcache, | ||
arena_t * | arena | ||
) |
JEMALLOC_ALWAYS_INLINE void iqalloc | ( | void * | ptr | ) |
JEMALLOC_ALWAYS_INLINE void iqalloct | ( | void * | ptr, |
bool | try_tcache | ||
) |
JEMALLOC_ALWAYS_INLINE void* iralloc | ( | void * | ptr, |
size_t | size, | ||
size_t | extra, | ||
size_t | alignment, | ||
bool | zero | ||
) |
JEMALLOC_ALWAYS_INLINE void* iralloct | ( | void * | ptr, |
size_t | size, | ||
size_t | extra, | ||
size_t | alignment, | ||
bool | zero, | ||
bool | try_tcache_alloc, | ||
bool | try_tcache_dalloc, | ||
arena_t * | arena | ||
) |
JEMALLOC_ALWAYS_INLINE void* iralloct_realign | ( | void * | ptr, |
size_t | oldsize, | ||
size_t | size, | ||
size_t | extra, | ||
size_t | alignment, | ||
bool | zero, | ||
bool | try_tcache_alloc, | ||
bool | try_tcache_dalloc, | ||
arena_t * | arena | ||
) |
JEMALLOC_ALWAYS_INLINE size_t isalloc | ( | const void * | ptr, |
bool | demote | ||
) |
JEMALLOC_ALWAYS_INLINE size_t ivsalloc | ( | const void * | ptr, |
bool | demote | ||
) |
JEMALLOC_ALWAYS_INLINE bool ixalloc | ( | void * | ptr, |
size_t | size, | ||
size_t | extra, | ||
size_t | alignment, | ||
bool | zero | ||
) |
void jemalloc_postfork_child | ( | void | ) |
void jemalloc_postfork_parent | ( | void | ) |
void jemalloc_prefork | ( | void | ) |
malloc_tsd_externs | ( | arenas | , |
arena_t * | |||
) |
malloc_tsd_externs | ( | thread_allocated | , |
thread_allocated_t | |||
) |
JEMALLOC_INLINE unsigned narenas_total_get | ( | void | ) |
JEMALLOC_INLINE size_t p2rz | ( | const void * | ptr | ) |
arena_t arenas_cleanup JEMALLOC_ALWAYS_INLINE size_t s2u | ( | size_t | size | ) |
JEMALLOC_ALWAYS_INLINE size_t sa2u | ( | size_t | size, |
size_t | alignment | ||
) |
JEMALLOC_INLINE size_t u2rz | ( | size_t | usize | ) |
arenas |
malloc_mutex_t arenas_lock |
unsigned narenas_auto |
unsigned narenas_total |
unsigned ncpus |
arena_t NULL |
bool opt_abort |
bool opt_junk |
size_t opt_narenas |
size_t opt_quarantine |
bool opt_redzone |
bool opt_utrace |
bool opt_valgrind |
bool opt_xmalloc |
bool opt_zero |
thread_allocated |
THREAD_ALLOCATED_INITIALIZER |