]>
Commit | Line | Data |
---|---|---|
970d7e83 LB |
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 | ||
54a0048b | 32 | void quarantine_alloc_hook_work(tsd_t *tsd); |
1a4d82fc JJ |
33 | void quarantine(tsd_t *tsd, void *ptr); |
34 | void quarantine_cleanup(tsd_t *tsd); | |
970d7e83 LB |
35 | |
36 | #endif /* JEMALLOC_H_EXTERNS */ | |
37 | /******************************************************************************/ | |
38 | #ifdef JEMALLOC_H_INLINES | |
39 | ||
40 | #ifndef JEMALLOC_ENABLE_INLINE | |
970d7e83 LB |
41 | void quarantine_alloc_hook(void); |
42 | #endif | |
43 | ||
44 | #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_QUARANTINE_C_)) | |
970d7e83 LB |
45 | JEMALLOC_ALWAYS_INLINE void |
46 | quarantine_alloc_hook(void) | |
47 | { | |
1a4d82fc | 48 | tsd_t *tsd; |
970d7e83 LB |
49 | |
50 | assert(config_fill && opt_quarantine); | |
51 | ||
1a4d82fc | 52 | tsd = tsd_fetch(); |
54a0048b SL |
53 | if (tsd_quarantine_get(tsd) == NULL) |
54 | quarantine_alloc_hook_work(tsd); | |
970d7e83 LB |
55 | } |
56 | #endif | |
57 | ||
58 | #endif /* JEMALLOC_H_INLINES */ | |
59 | /******************************************************************************/ | |
60 |