static int gs_PoolUsed##POOLTYPE[PoolSize] = {0}; \
MAYBE_UNUSED
static int gs_PoolDummy##POOLTYPE = (
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE,
sizeof(gs_PoolData##POOLTYPE)), 0); \
void *POOLTYPE::operator new(size_t Size, int Id) \
{ \
dbg_assert(sizeof(POOLTYPE) >= Size, "size error"); \
dbg_assert(!gs_PoolUsed##POOLTYPE[Id], "already used"); \
ASAN_UNPOISON_MEMORY_REGION(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
gs_PoolUsed##POOLTYPE[Id] = 1; \
mem_zero(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
return gs_PoolData##POOLTYPE[Id]; \
} \
void POOLTYPE::operator delete(void *pObj, int Id) \
{ \
dbg_assert(gs_PoolUsed##POOLTYPE[Id], "not used"); \
dbg_assert(Id == (POOLTYPE *)pObj - (POOLTYPE *)gs_PoolData##POOLTYPE, "invalid id"); \
gs_PoolUsed##POOLTYPE[Id] = 0; \
mem_zero(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
} \
void POOLTYPE::operator delete(void *pObj) \
{ \
int Id = (POOLTYPE *)pObj - (POOLTYPE *)gs_PoolData##POOLTYPE; \
dbg_assert(gs_PoolUsed##POOLTYPE[Id], "not used"); \
gs_PoolUsed##POOLTYPE[Id] = 0; \
mem_zero(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
}
#define ASAN_POISON_MEMORY_REGION(addr, size)
Definition: alloc.h:15
#define MACRO_ALLOC_GET_SIZE(POOLTYPE)
Definition: alloc.h:47