1234370Sjasone/******************************************************************************/ 2234370Sjasone#ifdef JEMALLOC_H_TYPES 3234370Sjasone 4251300Sjasonetypedef struct quarantine_obj_s quarantine_obj_t; 5251300Sjasonetypedef struct quarantine_s quarantine_t; 6251300Sjasone 7234370Sjasone/* Default per thread quarantine size if valgrind is enabled. */ 8234370Sjasone#define JEMALLOC_VALGRIND_QUARANTINE_DEFAULT (ZU(1) << 24) 9234370Sjasone 10234370Sjasone#endif /* JEMALLOC_H_TYPES */ 11234370Sjasone/******************************************************************************/ 12234370Sjasone#ifdef JEMALLOC_H_STRUCTS 13234370Sjasone 14251300Sjasonestruct quarantine_obj_s { 15251300Sjasone void *ptr; 16251300Sjasone size_t usize; 17251300Sjasone}; 18251300Sjasone 19251300Sjasonestruct quarantine_s { 20251300Sjasone size_t curbytes; 21251300Sjasone size_t curobjs; 22251300Sjasone size_t first; 23251300Sjasone#define LG_MAXOBJS_INIT 10 24251300Sjasone size_t lg_maxobjs; 25251300Sjasone quarantine_obj_t objs[1]; /* Dynamically sized ring buffer. */ 26251300Sjasone}; 27251300Sjasone 28234370Sjasone#endif /* JEMALLOC_H_STRUCTS */ 29234370Sjasone/******************************************************************************/ 30234370Sjasone#ifdef JEMALLOC_H_EXTERNS 31234370Sjasone 32251300Sjasonequarantine_t *quarantine_init(size_t lg_maxobjs); 33234370Sjasonevoid quarantine(void *ptr); 34251300Sjasonevoid quarantine_cleanup(void *arg); 35234370Sjasonebool quarantine_boot(void); 36234370Sjasone 37234370Sjasone#endif /* JEMALLOC_H_EXTERNS */ 38234370Sjasone/******************************************************************************/ 39234370Sjasone#ifdef JEMALLOC_H_INLINES 40234370Sjasone 41251300Sjasone#ifndef JEMALLOC_ENABLE_INLINE 42251300Sjasonemalloc_tsd_protos(JEMALLOC_ATTR(unused), quarantine, quarantine_t *) 43251300Sjasone 44251300Sjasonevoid quarantine_alloc_hook(void); 45251300Sjasone#endif 46251300Sjasone 47251300Sjasone#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_QUARANTINE_C_)) 48251300Sjasonemalloc_tsd_externs(quarantine, quarantine_t *) 49251300Sjasonemalloc_tsd_funcs(JEMALLOC_ALWAYS_INLINE, quarantine, quarantine_t *, NULL, 50251300Sjasone quarantine_cleanup) 51251300Sjasone 52251300SjasoneJEMALLOC_ALWAYS_INLINE void 53251300Sjasonequarantine_alloc_hook(void) 54251300Sjasone{ 55251300Sjasone quarantine_t *quarantine; 56251300Sjasone 57251300Sjasone assert(config_fill && opt_quarantine); 58251300Sjasone 59251300Sjasone quarantine = *quarantine_tsd_get(); 60251300Sjasone if (quarantine == NULL) 61251300Sjasone quarantine_init(LG_MAXOBJS_INIT); 62251300Sjasone} 63251300Sjasone#endif 64251300Sjasone 65234370Sjasone#endif /* JEMALLOC_H_INLINES */ 66234370Sjasone/******************************************************************************/ 67234370Sjasone 68