fix malloc_sample_bt

This commit is contained in:
tushicheng 2023-05-11 12:53:28 +00:00 committed by ob-robot
parent 20101d03dd
commit 93d27616e0

View File

@ -162,16 +162,14 @@ inline bool ObMallocSampleKey::operator==(const ObMallocSampleKey &other) const
return ret;
}
#define ob_malloc_sample_backtrace(obj, size) \
{ \
if (OB_UNLIKELY(obj->on_malloc_sample_)) { \
void *addrs[100]; \
int bt_len = OB_BACKTRACE_M(addrs, ARRAYSIZEOF(addrs)); \
MEMCPY(&obj->data_[size], (char*)addrs, AOBJECT_BACKTRACE_SIZE); \
if (AOBJECT_BACKTRACE_COUNT > bt_len) { \
reinterpret_cast<void*&>(obj->data_[size + bt_len * sizeof(void*)]) = nullptr; \
} \
} \
#define ob_malloc_sample_backtrace(obj, size) \
{ \
if (OB_UNLIKELY(obj->on_malloc_sample_)) { \
void *addrs[100] = {nullptr}; \
int bt_len = OB_BACKTRACE_M(addrs, ARRAYSIZEOF(addrs)); \
STATIC_ASSERT(AOBJECT_BACKTRACE_SIZE < sizeof(addrs), "AOBJECT_BACKTRACE_SIZE must be less than addrs!"); \
MEMCPY(&obj->data_[size], (char*)addrs, AOBJECT_BACKTRACE_SIZE); \
} \
}
} // end of namespace lib
} // end of namespace oceanbase