TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
quarantine.h
Go to the documentation of this file.
1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
3 
4 typedef struct quarantine_obj_s quarantine_obj_t;
5 typedef struct quarantine_s quarantine_t;
6 
7 /* Default per thread quarantine size if valgrind is enabled. */
8 #define JEMALLOC_VALGRIND_QUARANTINE_DEFAULT (ZU(1) << 24)
9 
10 #endif /* JEMALLOC_H_TYPES */
11 /******************************************************************************/
12 #ifdef JEMALLOC_H_STRUCTS
13 
14 struct quarantine_obj_s {
15  void *ptr;
16  size_t usize;
17 };
18 
19 struct quarantine_s {
20  size_t curbytes;
21  size_t curobjs;
22  size_t first;
23 #define LG_MAXOBJS_INIT 10
24  size_t lg_maxobjs;
25  quarantine_obj_t objs[1]; /* Dynamically sized ring buffer. */
26 };
27 
28 #endif /* JEMALLOC_H_STRUCTS */
29 /******************************************************************************/
30 #ifdef JEMALLOC_H_EXTERNS
31 
32 quarantine_t *quarantine_init(size_t lg_maxobjs);
33 void quarantine(void *ptr);
34 void quarantine_cleanup(void *arg);
35 bool quarantine_boot(void);
36 
37 #endif /* JEMALLOC_H_EXTERNS */
38 /******************************************************************************/
39 #ifdef JEMALLOC_H_INLINES
40 
41 #ifndef JEMALLOC_ENABLE_INLINE
42 malloc_tsd_protos(JEMALLOC_ATTR(unused), quarantine, quarantine_t *)
43 
44 void quarantine_alloc_hook(void);
45 #endif
46 
47 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_QUARANTINE_C_))
48 malloc_tsd_externs(quarantine, quarantine_t *)
49 malloc_tsd_funcs(JEMALLOC_ALWAYS_INLINE, quarantine, quarantine_t *, NULL,
51 
52 JEMALLOC_ALWAYS_INLINE void
54 {
55  quarantine_t *quarantine;
56 
57  assert(config_fill && opt_quarantine);
58 
59  quarantine = *quarantine_tsd_get();
60  if (quarantine == NULL)
61  quarantine_init(LG_MAXOBJS_INIT);
62 }
63 #endif
64 
65 #endif /* JEMALLOC_H_INLINES */
66 /******************************************************************************/
67 
#define quarantine_tsd_get
Definition: private_namespace.h:333
arena_t NULL
Definition: jemalloc_internal.h:624
#define quarantine_cleanup
Definition: private_namespace.h:327
#define quarantine_init
Definition: private_namespace.h:328
static const bool config_fill
Definition: jemalloc_internal.h:92
size_t opt_quarantine
#define JEMALLOC_ALWAYS_INLINE
Definition: jemalloc_internal.h:256
internal::NamedArg< char > arg(StringRef name, const T &arg)
Definition: format.h:3248
#define quarantine_boot
Definition: private_namespace.h:325
malloc_tsd_externs(arenas, arena_t *) malloc_tsd_funcs(JEMALLOC_ALWAYS_INLINE
#define quarantine_alloc_hook
Definition: private_namespace.h:324
#define quarantine
Definition: private_namespace.h:323