1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
4 typedef struct quarantine_obj_s quarantine_obj_t;
5 typedef struct quarantine_s quarantine_t;
7 /* Default per thread quarantine size if valgrind is enabled. */
8 #define JEMALLOC_VALGRIND_QUARANTINE_DEFAULT (ZU(1) << 24)
10 #endif /* JEMALLOC_H_TYPES */
11 /******************************************************************************/
12 #ifdef JEMALLOC_H_STRUCTS
14 struct quarantine_obj_s {
23 #define LG_MAXOBJS_INIT 10
25 quarantine_obj_t objs[1]; /* Dynamically sized ring buffer. */
28 #endif /* JEMALLOC_H_STRUCTS */
29 /******************************************************************************/
30 #ifdef JEMALLOC_H_EXTERNS
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);
37 #endif /* JEMALLOC_H_EXTERNS */
38 /******************************************************************************/
39 #ifdef JEMALLOC_H_INLINES
41 #ifndef JEMALLOC_ENABLE_INLINE
42 malloc_tsd_protos(JEMALLOC_ATTR(unused), quarantine, quarantine_t *)
44 void quarantine_alloc_hook(void);
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,
52 JEMALLOC_ALWAYS_INLINE void
53 quarantine_alloc_hook(void)
55 quarantine_t *quarantine;
57 assert(config_fill && opt_quarantine);
59 quarantine = *quarantine_tsd_get();
60 if (quarantine == NULL)
61 quarantine_init(LG_MAXOBJS_INIT);
65 #endif /* JEMALLOC_H_INLINES */
66 /******************************************************************************/