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; return ret;
} }
#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)); \
MEMCPY(&obj->data_[size], (char*)addrs, AOBJECT_BACKTRACE_SIZE); \ STATIC_ASSERT(AOBJECT_BACKTRACE_SIZE < sizeof(addrs), "AOBJECT_BACKTRACE_SIZE must be less than addrs!"); \
if (AOBJECT_BACKTRACE_COUNT > bt_len) { \ MEMCPY(&obj->data_[size], (char*)addrs, AOBJECT_BACKTRACE_SIZE); \
reinterpret_cast<void*&>(obj->data_[size + bt_len * sizeof(void*)]) = nullptr; \ } \
} \
} \
} }
} // end of namespace lib } // end of namespace lib
} // end of namespace oceanbase } // end of namespace oceanbase