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

@ -165,12 +165,10 @@ inline bool ObMallocSampleKey::operator==(const ObMallocSampleKey &other) const
#define ob_malloc_sample_backtrace(obj, size) \ #define ob_malloc_sample_backtrace(obj, size) \
{ \ { \
if (OB_UNLIKELY(obj->on_malloc_sample_)) { \ if (OB_UNLIKELY(obj->on_malloc_sample_)) { \
void *addrs[100]; \ void *addrs[100] = {nullptr}; \
int bt_len = OB_BACKTRACE_M(addrs, ARRAYSIZEOF(addrs)); \ 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); \ 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; \
} \
} \ } \
} }
} // end of namespace lib } // end of namespace lib