diff --git a/deps/oblib/src/lib/alloc/ob_tenant_ctx_allocator.cpp b/deps/oblib/src/lib/alloc/ob_tenant_ctx_allocator.cpp index 95a731403..2434ec670 100644 --- a/deps/oblib/src/lib/alloc/ob_tenant_ctx_allocator.cpp +++ b/deps/oblib/src/lib/alloc/ob_tenant_ctx_allocator.cpp @@ -30,7 +30,6 @@ void *ObTenantCtxAllocator::alloc(const int64_t size, const ObMemAttr &attr) { abort_unless(attr.tenant_id_ == tenant_id_); abort_unless(attr.ctx_id_ == ctx_id_); - BACKTRACE_RET(WARN, OB_INVALID_ARGUMENT, !attr.label_.is_valid(), "[OB_MOD_DO_NOT_USE_ME ALLOC]size:%ld", size); void *ptr = common_alloc(size, attr, *this, obj_mgr_); return ptr; } @@ -44,7 +43,6 @@ int64_t ObTenantCtxAllocator::get_obj_hold(void *ptr) void* ObTenantCtxAllocator::realloc(const void *ptr, const int64_t size, const ObMemAttr &attr) { - BACKTRACE_RET(WARN, OB_INVALID_ARGUMENT, !attr.label_.is_valid(), "[OB_MOD_DO_NOT_USE_ME REALLOC]size:%ld", size); void *nptr = common_realloc(ptr, size, attr, *this, obj_mgr_); return nptr; } @@ -401,6 +399,9 @@ void* ObTenantCtxAllocator::common_alloc(const int64_t size, const ObMemAttr &at { SANITY_DISABLE_CHECK_RANGE(); // prevent sanity_check_range void *ret = nullptr; + if (!attr.label_.is_valid()) { + LIB_LOG_RET(ERROR, OB_INVALID_ARGUMENT, "OB_MOD_DO_NOT_USE_ME ALLOC", K(size)); + } bool sample_allowed = ObMallocSampleLimiter::malloc_sample_allowed(size, attr); const int64_t alloc_size = sample_allowed ? (size + AOBJECT_BACKTRACE_SIZE) : size; AObject *obj = allocator.alloc_object(alloc_size, attr); @@ -443,6 +444,9 @@ void* ObTenantCtxAllocator::common_realloc(const void *ptr, const int64_t size, { SANITY_DISABLE_CHECK_RANGE(); // prevent sanity_check_range void *nptr = NULL; + if (!attr.label_.is_valid()) { + LIB_LOG_RET(ERROR, OB_INVALID_ARGUMENT, "OB_MOD_DO_NOT_USE_ME REALLOC", K(size)); + } AObject *obj = NULL; if (NULL != ptr) { obj = reinterpret_cast((char*)ptr - AOBJECT_HEADER_SIZE); diff --git a/deps/oblib/src/lib/allocator/ob_allocator.h b/deps/oblib/src/lib/allocator/ob_allocator.h index 3c77cc595..deac8192c 100644 --- a/deps/oblib/src/lib/allocator/ob_allocator.h +++ b/deps/oblib/src/lib/allocator/ob_allocator.h @@ -21,7 +21,6 @@ namespace oceanbase namespace common { using lib::ObMemAttr; -extern ObMemAttr default_memattr; class ObIAllocator { public: @@ -80,7 +79,8 @@ public: { return NULL == alloc_ ? NULL : alloc_->alloc(sz, attr); } - virtual void *alloc(const int64_t sz) { return alloc(sz, default_memattr); } + virtual void *alloc(const int64_t sz) + { return NULL == alloc_ ? NULL : alloc_->alloc(sz); } virtual void* realloc(const void *ptr, const int64_t size, const ObMemAttr &attr) { return NULL == alloc_ ? NULL : alloc_->realloc(ptr, size, attr); } diff --git a/deps/oblib/src/lib/allocator/ob_allocator_v2.cpp b/deps/oblib/src/lib/allocator/ob_allocator_v2.cpp index f50f368c8..d839a80ef 100644 --- a/deps/oblib/src/lib/allocator/ob_allocator_v2.cpp +++ b/deps/oblib/src/lib/allocator/ob_allocator_v2.cpp @@ -30,7 +30,6 @@ void *ObAllocator::alloc(const int64_t size, const ObMemAttr &attr) ret = init(); } if (OB_SUCC(ret)) { - BACKTRACE_RET(WARN, OB_INVALID_ARGUMENT, !attr.label_.is_valid(), "[OB_MOD_DO_NOT_USE_ME ALLOC]size:%ld", size); ObMemAttr inner_attr = attr_; if (attr.label_.is_valid()) { inner_attr.label_ = attr.label_; diff --git a/deps/oblib/src/lib/allocator/ob_allocator_v2.h b/deps/oblib/src/lib/allocator/ob_allocator_v2.h index bd338ae88..6b4738cab 100644 --- a/deps/oblib/src/lib/allocator/ob_allocator_v2.h +++ b/deps/oblib/src/lib/allocator/ob_allocator_v2.h @@ -44,7 +44,7 @@ class ObAllocator : public ObIAllocator friend class lib::__MemoryContext__; friend class ObParallelAllocator; public: - ObAllocator(__MemoryContext__ *mem_context, const ObMemAttr &attr = default_memattr, + ObAllocator(__MemoryContext__ *mem_context, const ObMemAttr &attr, const bool use_pm=false, const uint32_t ablock_size=lib::INTACT_NORMAL_AOBJECT_SIZE); virtual ~ObAllocator() {} @@ -176,7 +176,7 @@ class ObParallelAllocator : public ObIAllocator public: ObParallelAllocator(ObAllocator &root_allocator, __MemoryContext__ *mem_context, - const ObMemAttr &attr=default_memattr, + const ObMemAttr &attr, const int parallel=4, const uint32_t ablock_size=lib::INTACT_NORMAL_AOBJECT_SIZE); virtual ~ObParallelAllocator(); diff --git a/deps/oblib/src/lib/allocator/ob_fifo_allocator.h b/deps/oblib/src/lib/allocator/ob_fifo_allocator.h index f2579075c..ce1a862c6 100644 --- a/deps/oblib/src/lib/allocator/ob_fifo_allocator.h +++ b/deps/oblib/src/lib/allocator/ob_fifo_allocator.h @@ -90,7 +90,7 @@ public: int init(ObIAllocator *allocator, const int64_t page_size, - const ObMemAttr &attr=default_memattr, + const ObMemAttr &attr, const int64_t init_size=0, const int64_t idle_size=256L << 10, const int64_t max_size=INT64_MAX); diff --git a/deps/oblib/src/lib/allocator/ob_malloc.cpp b/deps/oblib/src/lib/allocator/ob_malloc.cpp index 0a9eedb6c..7c7c79246 100644 --- a/deps/oblib/src/lib/allocator/ob_malloc.cpp +++ b/deps/oblib/src/lib/allocator/ob_malloc.cpp @@ -19,7 +19,6 @@ #include #endif -oceanbase::common::ObMemAttr oceanbase::common::default_memattr; int oceanbase::common::ObMemBuf::ensure_space(const int64_t size, const lib::ObLabel &label) { diff --git a/deps/oblib/src/lib/allocator/ob_malloc.h b/deps/oblib/src/lib/allocator/ob_malloc.h index a0c13f58c..aa5e79317 100644 --- a/deps/oblib/src/lib/allocator/ob_malloc.h +++ b/deps/oblib/src/lib/allocator/ob_malloc.h @@ -29,8 +29,7 @@ inline void ob_print_mod_memory_usage(bool print_to_std = false, UNUSEDx(print_to_std, print_glibc_malloc_stats); } -extern ObMemAttr default_memattr; -inline void *ob_malloc(const int64_t nbyte, const ObMemAttr &attr = default_memattr) +inline void *ob_malloc(const int64_t nbyte, const ObMemAttr &attr) { void *ptr = NULL; auto allocator = lib::ObMallocAllocator::get_instance(); @@ -70,7 +69,7 @@ inline void *ob_realloc(void *ptr, const int64_t nbyte, const ObMemAttr &attr) void *ob_malloc_align( const int64_t alignment, const int64_t nbyte, - const ObMemAttr &attr = default_memattr); + const ObMemAttr &attr); void ob_free_align(void *ptr); // Deprecated interface diff --git a/deps/oblib/src/lib/allocator/ob_page_manager.h b/deps/oblib/src/lib/allocator/ob_page_manager.h index 99f69bac2..4fd352da4 100644 --- a/deps/oblib/src/lib/allocator/ob_page_manager.h +++ b/deps/oblib/src/lib/allocator/ob_page_manager.h @@ -25,7 +25,6 @@ namespace oceanbase { namespace common { -using oceanbase::common::default_memattr; using lib::BlockSet; using lib::AChunk; using lib::ABlock; @@ -71,7 +70,7 @@ public: int64_t get_hold() const; int64_t get_tid() const { return tid_; } // IBlockMgr interface - virtual ABlock *alloc_block(uint64_t size, const ObMemAttr &attr=default_memattr) override; + virtual ABlock *alloc_block(uint64_t size, const ObMemAttr &attr) override; virtual void free_block(ABlock *block) override; virtual int64_t sync_wash(int64_t wash_size) override { diff --git a/deps/oblib/src/lib/allocator/ob_safe_arena.h b/deps/oblib/src/lib/allocator/ob_safe_arena.h index 9058739d1..3e5268784 100644 --- a/deps/oblib/src/lib/allocator/ob_safe_arena.h +++ b/deps/oblib/src/lib/allocator/ob_safe_arena.h @@ -23,10 +23,10 @@ namespace common class ObSafeArena : public ObIAllocator { public: - ObSafeArena(const lib::ObLabel &label, const int64_t page_size = OB_MALLOC_NORMAL_BLOCK_SIZE, ObMemAttr attr = default_memattr) - : arena_alloc_(label, page_size, attr.tenant_id_), - lock_(ObLatchIds::OB_AREAN_ALLOCATOR_LOCK), - attr_(attr) + ObSafeArena(const lib::ObLabel &label, const int64_t page_size = OB_MALLOC_NORMAL_BLOCK_SIZE, + int64_t tenant_id = OB_SERVER_TENANT_ID) + : arena_alloc_(label, page_size, tenant_id), + lock_(ObLatchIds::OB_AREAN_ALLOCATOR_LOCK) {} virtual ~ObSafeArena() {} @@ -34,7 +34,8 @@ public: public: virtual void *alloc(const int64_t sz) override { - return alloc(sz, attr_); + ObSpinLockGuard guard(lock_); + return arena_alloc_.alloc(sz); } virtual void* alloc(const int64_t sz, const ObMemAttr &attr) override @@ -81,7 +82,6 @@ public: private: ObArenaAllocator arena_alloc_; ObSpinLock lock_; - ObMemAttr attr_; private: DISALLOW_COPY_AND_ASSIGN(ObSafeArena); diff --git a/deps/oblib/src/lib/allocator/page_arena.h b/deps/oblib/src/lib/allocator/page_arena.h index 3c8c0ca83..9ec1e78a6 100644 --- a/deps/oblib/src/lib/allocator/page_arena.h +++ b/deps/oblib/src/lib/allocator/page_arena.h @@ -91,7 +91,7 @@ struct ModulePageAllocator: public ObIAllocator tenant_id_(tenant_id), ctx_id_(ctx_id) {} explicit ModulePageAllocator(ObIAllocator &allocator, - const lib::ObLabel &label = lib::ObLabel()) + const lib::ObLabel &label = ObModIds::OB_MODULE_PAGE_ALLOCATOR) : allocator_(&allocator), label_(label), tenant_id_(OB_SERVER_TENANT_ID), @@ -1095,7 +1095,8 @@ public: public: void *alloc(const int64_t sz) override { - return alloc(sz, default_memattr); + ObSpinLockGuard guard(lock_); + return arena_.alloc(sz); } void *alloc(const int64_t sz, const ObMemAttr &attr) override { diff --git a/deps/oblib/src/lib/hash/ob_hashtable.h b/deps/oblib/src/lib/hash/ob_hashtable.h index f18b3c873..d8a79a6dd 100644 --- a/deps/oblib/src/lib/hash/ob_hashtable.h +++ b/deps/oblib/src/lib/hash/ob_hashtable.h @@ -783,7 +783,8 @@ private: DISALLOW_COPY_AND_ASSIGN(ObHashTable); public: - ObHashTable() : allocer_(NULL), + ObHashTable() : default_bucket_allocer_(ObModIds::OB_HASH_BUCKET), + allocer_(NULL), bucket_allocer_(&default_bucket_allocer_), bucket_num_(0), size_(0) diff --git a/deps/oblib/src/lib/rc/context.h b/deps/oblib/src/lib/rc/context.h index 4b100650c..1e20475af 100644 --- a/deps/oblib/src/lib/rc/context.h +++ b/deps/oblib/src/lib/rc/context.h @@ -69,7 +69,6 @@ namespace lib using std::nullptr_t; using lib::ObMemAttr; -using oceanbase::common::default_memattr; class Flow; class __MemoryContext__; enum class ContextSource @@ -331,14 +330,12 @@ public: const DynamicInfo &get_dynamic_info() const { return di_; } const StaticInfo &get_static_info() const { return *reinterpret_cast(static_id_); } void *allocf(const int64_t size, - const ObMemAttr &attr=default_memattr) + const ObMemAttr &attr) { return freeable_alloc_->alloc(size, attr); } - void *allocp(const int64_t size, - const ObMemAttr &attr=default_memattr) + void *allocp(const int64_t size) { - UNUSEDx(attr); void *ptr = nullptr; ptr = arena_alloc_.alloc(size); return ptr; @@ -759,15 +756,14 @@ private: }; inline void *ctxalf(const int64_t size, - const ObMemAttr &attr=default_memattr) + const ObMemAttr &attr) { return CURRENT_CONTEXT->allocf(size, attr); } -inline void *ctxalp(const int64_t size, - const ObMemAttr &attr=default_memattr) +inline void *ctxalp(const int64_t size) { - return CURRENT_CONTEXT->allocp(size, attr); + return CURRENT_CONTEXT->allocp(size); } inline void ctxfree(void *ptr) diff --git a/deps/oblib/src/lib/timezone/ob_timezone_util.cpp b/deps/oblib/src/lib/timezone/ob_timezone_util.cpp index d2c1935d3..816638def 100644 --- a/deps/oblib/src/lib/timezone/ob_timezone_util.cpp +++ b/deps/oblib/src/lib/timezone/ob_timezone_util.cpp @@ -211,7 +211,7 @@ int ObTimezoneUtils::parse_timezone_file(const ObString& timezone_file_name) ALIGN_SIZE(sp.typecnt * sizeof(TRAN_TYPE_INFO)) + ALIGN_SIZE(sp.charcnt) + sp.leapcnt * sizeof(LS_INFO); - tzinfo_buf = (char *)ob_malloc(bufSize); + tzinfo_buf = (char *)ob_malloc(bufSize, "TimeZoneUtils"); if(NULL == tzinfo_buf){ ret = OB_ALLOCATE_MEMORY_FAILED; } else { @@ -415,8 +415,8 @@ int ObTimezoneUtils::prepare_tz_info(TIME_ZONE_INFO &tz_info) } /* set maximum end_l as finisher */ revts[tz_info.revcnt] = end_l; - if(!(tz_info.revts = (my_time_t*)ob_malloc(sizeof(my_time_t) * (tz_info.revcnt + 1))) - || !(tz_info.revtis = (REVT_INFO*)ob_malloc(sizeof(REVT_INFO) * tz_info.revcnt)) + if(!(tz_info.revts = (my_time_t*)ob_malloc(sizeof(my_time_t) * (tz_info.revcnt + 1), "TimeZoneUtils")) + || !(tz_info.revtis = (REVT_INFO*)ob_malloc(sizeof(REVT_INFO) * tz_info.revcnt, "TimeZoneUtils")) ){ OB_LOG(ERROR, "ob_malloc for tz_info.revts tz_info.revtis failed"); ret = OB_ALLOCATE_MEMORY_FAILED; diff --git a/deps/oblib/src/rpc/obmysql/ob_2_0_protocol_utils.cpp b/deps/oblib/src/rpc/obmysql/ob_2_0_protocol_utils.cpp index 6d447977b..25c3b02da 100644 --- a/deps/oblib/src/rpc/obmysql/ob_2_0_protocol_utils.cpp +++ b/deps/oblib/src/rpc/obmysql/ob_2_0_protocol_utils.cpp @@ -40,7 +40,7 @@ inline int ObProtoEncodeParam::save_large_packet(const char *start, const int64_ } else if (OB_UNLIKELY(NULL != large_pkt_buf_)) { ret = OB_ERR_UNEXPECTED; LOG_ERROR("large pkt buf has already exist", KP(start), K(len), K(ret)); - } else if (OB_ISNULL(large_pkt_buf_ = (char *)ob_malloc(len))) { + } else if (OB_ISNULL(large_pkt_buf_ = (char *)ob_malloc(len, "ProtoEncodePara"))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_ERROR("fail to alloc mem", K(len), K(ret)); } else { diff --git a/deps/oblib/unittest/lib/alloc/test_block_set.cpp b/deps/oblib/unittest/lib/alloc/test_block_set.cpp index 1ba729fc1..a49797b1c 100644 --- a/deps/oblib/unittest/lib/alloc/test_block_set.cpp +++ b/deps/oblib/unittest/lib/alloc/test_block_set.cpp @@ -173,7 +173,7 @@ TEST_F(TestBlockSet, BigBlockOrigin) void *p = NULL; while (cnt--) { - p = ob_malloc(sz); + p = ob_malloc(sz, ObNewModIds::TEST); check_ptr(p); ob_free(p); } diff --git a/deps/oblib/unittest/lib/alloc/test_ob_malloc_callback_guard.cpp b/deps/oblib/unittest/lib/alloc/test_ob_malloc_callback_guard.cpp index cdbf4e1ec..920d9ee5d 100644 --- a/deps/oblib/unittest/lib/alloc/test_ob_malloc_callback_guard.cpp +++ b/deps/oblib/unittest/lib/alloc/test_ob_malloc_callback_guard.cpp @@ -42,7 +42,7 @@ TEST_F(TestObMallocCallbackGuard, AllocAndFree) int64_t hold = 0; MallocCallback cb(hold); ObMallocCallbackGuard guard(cb); - auto *ptr = ob_malloc(2113); + auto *ptr = ob_malloc(2113, ObNewModIds::TEST); std::cout << "alloc" << std::endl; ASSERT_EQ(hold, 8192); ob_free(ptr); @@ -52,7 +52,7 @@ TEST_F(TestObMallocCallbackGuard, AllocAndFree) int64_t hold2 = 0; MallocCallback cb(hold2); ObMallocCallbackGuard guard(cb); - auto *ptr = ob_malloc(2113); + auto *ptr = ob_malloc(2113, ObNewModIds::TEST); ASSERT_EQ(hold, 8192); ASSERT_EQ(hold2, 8192); std::cout << "alloc" << std::endl; @@ -61,7 +61,7 @@ TEST_F(TestObMallocCallbackGuard, AllocAndFree) ASSERT_EQ(hold2, 0); std::cout << "free" << std::endl << std::endl; } - ptr = ob_malloc(2113); + ptr = ob_malloc(2113, ObNewModIds::TEST); ASSERT_EQ(hold, 8192); std::cout << "alloc" << std::endl; ob_free(ptr); diff --git a/deps/oblib/unittest/lib/alloc/test_object_mgr.cpp b/deps/oblib/unittest/lib/alloc/test_object_mgr.cpp index 96477a2e4..0b49e39e0 100644 --- a/deps/oblib/unittest/lib/alloc/test_object_mgr.cpp +++ b/deps/oblib/unittest/lib/alloc/test_object_mgr.cpp @@ -42,7 +42,7 @@ public: // p = obj->data_; // } // return p; - return oceanbase::common::ob_malloc(size); + return oceanbase::common::ob_malloc(size, ObNewModIds::TEST); } void Free(void *ptr) @@ -66,22 +66,9 @@ TEST_F(TestObjectMgr, Basic2) while (cnt--) { int i = 0; - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); - p[i++] = ob_malloc(sz); + for (int j = 0; j < 16; ++j) { + p[i++] = ob_malloc(sz, ObNewModIds::TEST); + } while (i--) { ob_free(p[i]); } diff --git a/deps/oblib/unittest/lib/allocator/test_fifo.cpp b/deps/oblib/unittest/lib/allocator/test_fifo.cpp index a1e8406ec..627eaaf14 100644 --- a/deps/oblib/unittest/lib/allocator/test_fifo.cpp +++ b/deps/oblib/unittest/lib/allocator/test_fifo.cpp @@ -32,6 +32,7 @@ const int64_t init_size = 0; int64_t glibc_alloc_count = 0; int64_t glibc_free_count = 0; +const ObMemAttr default_memattr(OB_SERVER_TENANT_ID, ObNewModIds::TEST); #define MOCK_ALIGN 512 #define MOCK_ALLOC_ALIGN 1 @@ -978,7 +979,7 @@ TEST(TestFIFO, init_idle_max) MockAllocator mock_allocator; ObFIFOAllocator fa; // invalid arg - ASSERT_NE(OB_SUCCESS, fa.init(&mock_allocator, 0)); + ASSERT_NE(OB_SUCCESS, fa.init(&mock_allocator, 0, default_memattr)); ASSERT_NE(OB_SUCCESS, fa.init(&mock_allocator, page_size, default_memattr, -1)); ASSERT_NE(OB_SUCCESS, fa.init(&mock_allocator, page_size, default_memattr, 0, -1)); ASSERT_NE(OB_SUCCESS, fa.init(&mock_allocator, page_size, default_memattr, 0, 0, -1)); diff --git a/deps/oblib/unittest/lib/allocator/test_page_arena.cpp b/deps/oblib/unittest/lib/allocator/test_page_arena.cpp index 4dc4a51ce..06ddeb421 100644 --- a/deps/oblib/unittest/lib/allocator/test_page_arena.cpp +++ b/deps/oblib/unittest/lib/allocator/test_page_arena.cpp @@ -22,12 +22,12 @@ struct MyPageAllocator: public ObIAllocator { UNUSED(attr); alloc_count_++; - return ob_malloc(sz); + return ob_malloc(sz, ObNewModIds::TEST); } void *alloc(const int64_t sz) { alloc_count_++; - return ob_malloc(sz); + return ob_malloc(sz, ObNewModIds::TEST); } void free(void *p) { diff --git a/deps/oblib/unittest/lib/allocator/test_slice_alloc.cpp b/deps/oblib/unittest/lib/allocator/test_slice_alloc.cpp index 0ff044034..9660307d7 100644 --- a/deps/oblib/unittest/lib/allocator/test_slice_alloc.cpp +++ b/deps/oblib/unittest/lib/allocator/test_slice_alloc.cpp @@ -42,7 +42,7 @@ public: struct ObMallocWrapper: public AllocInterface { public: - void* alloc() { return common::ob_malloc(ISIZE); } + void* alloc() { return common::ob_malloc(ISIZE, ObNewModIds::TEST); } void free(void* p) { common::ob_free(p); } }; diff --git a/deps/oblib/unittest/lib/hash/test_iteratable_hashset.cpp b/deps/oblib/unittest/lib/hash/test_iteratable_hashset.cpp index e9c9e12c2..7ac88db06 100644 --- a/deps/oblib/unittest/lib/hash/test_iteratable_hashset.cpp +++ b/deps/oblib/unittest/lib/hash/test_iteratable_hashset.cpp @@ -196,7 +196,7 @@ TEST(TestObIteratableHashSet, hash_full) { const uint64_t N = 10000; typedef ObIteratableHashSet HashSetType; - HashSetType *hashset = (HashSetType *)ob_malloc(sizeof(HashSetType)); + HashSetType *hashset = (HashSetType *)ob_malloc(sizeof(HashSetType), ObNewModIds::TEST); ASSERT_TRUE(NULL != hashset); new(hashset) HashSetType(); ASSERT_TRUE(NULL != hashset); diff --git a/deps/oblib/unittest/lib/list/test_dlist.cpp b/deps/oblib/unittest/lib/list/test_dlist.cpp index be146be1d..97d72764e 100644 --- a/deps/oblib/unittest/lib/list/test_dlist.cpp +++ b/deps/oblib/unittest/lib/list/test_dlist.cpp @@ -57,7 +57,7 @@ TEST_F(TestObDList, encode_decode) ASSERT_TRUE(list.add_last(&node2)); int64_t buf_size = get_dlist_serialize_size(list); - char *buf = static_cast(ob_malloc(buf_size)); + char *buf = static_cast(ob_malloc(buf_size, ObNewModIds::TEST)); int64_t buf_len = buf_size; int64_t pos = 0; ASSERT_EQ(OB_SUCCESS, serialize_dlist(list, buf, buf_len, pos)); diff --git a/deps/oblib/unittest/lib/rc/test_context.cpp b/deps/oblib/unittest/lib/rc/test_context.cpp index ba7db9609..45cdfab2d 100644 --- a/deps/oblib/unittest/lib/rc/test_context.cpp +++ b/deps/oblib/unittest/lib/rc/test_context.cpp @@ -71,6 +71,7 @@ TEST_F(TestContext, Basic) int64_t used = g_pm.used_; ASSERT_EQ(0, used); void *ptr = nullptr; + ObMemAttr attr(OB_SERVER_TENANT_ID, ObNewModIds::TEST); WITH_CONTEXT(mem_context) { ptr = ctxalp(100); ASSERT_NE(ptr, nullptr); @@ -103,7 +104,7 @@ TEST_F(TestContext, Basic) for (int i = 0; i < 64; ++i) { ptr = ctxalp(1024); ASSERT_NE(ptr, nullptr); - ptr = ctxalf(100); + ptr = ctxalf(100, attr); ASSERT_NE(ptr, nullptr); ObArenaAllocator &arena_alloc = CURRENT_CONTEXT->get_arena_allocator(); ptr = arena_alloc.alloc(1024); @@ -125,8 +126,8 @@ TEST_F(TestContext, Basic) { // In order to allow the object_set inside current_ctx to allocate free_list in advance // Don't let the memory occupied by free_list affect subsequent verification - ctxalf(8192 - 1000); - ptr = ctxalf(2000); + ctxalf(8192 - 1000, attr); + ptr = ctxalf(2000, attr); ASSERT_NE(ptr, nullptr); ctxfree(ptr); } diff --git a/deps/oblib/unittest/lib/utility/test_print_utils.cpp b/deps/oblib/unittest/lib/utility/test_print_utils.cpp index f5d4823cc..61deb6044 100644 --- a/deps/oblib/unittest/lib/utility/test_print_utils.cpp +++ b/deps/oblib/unittest/lib/utility/test_print_utils.cpp @@ -96,7 +96,7 @@ TEST(print_utility, to_cstring) const int size = 1300; const int number = 10; char data[size * number]; - char *buffer = (char*)ob_malloc(sizeof(MyTuple) * number); + char *buffer = (char*)ob_malloc(sizeof(MyTuple) * number, ObNewModIds::TEST); MyTuple *tuples[number]; for (int n = 0; n < number; ++n) { memset(&data[n * size], 'a' + n, size - 1); diff --git a/mittest/logservice/env/ob_simple_log_cluster_env.cpp b/mittest/logservice/env/ob_simple_log_cluster_env.cpp index b9aa91a4d..a9cf035a4 100644 --- a/mittest/logservice/env/ob_simple_log_cluster_env.cpp +++ b/mittest/logservice/env/ob_simple_log_cluster_env.cpp @@ -766,7 +766,7 @@ int ObSimpleLogClusterTestEnv::submit_log_impl(PalfHandleImplGuard &leader, PalfAppendOptions opts; ObRole role; while (buf == NULL) { - buf = static_cast(ob_malloc(buf_len)); + buf = static_cast(ob_malloc(buf_len, ObNewModIds::TEST)); } bool state; if (OB_FAIL(generate_data(buf, buf_len, real_log_data_size, data_len))) { diff --git a/mittest/logservice/test_ob_simple_log_basic_func.cpp b/mittest/logservice/test_ob_simple_log_basic_func.cpp index d70909afe..e19f7fab1 100644 --- a/mittest/logservice/test_ob_simple_log_basic_func.cpp +++ b/mittest/logservice/test_ob_simple_log_basic_func.cpp @@ -433,7 +433,8 @@ TEST_F(TestObSimpleLogClusterBasicFunc, data_corrupted) LSN lsn; EXPECT_EQ(OB_SUCCESS, iterator.next()); EXPECT_EQ(OB_SUCCESS, iterator.get_entry(entry, lsn)); - char *buf = static_cast(ob_malloc_align(LOG_DIO_ALIGN_SIZE, MAX_LOG_BUFFER_SIZE)); + char *buf = static_cast(ob_malloc_align(LOG_DIO_ALIGN_SIZE, MAX_LOG_BUFFER_SIZE, + ObMemAttr(OB_SERVER_TENANT_ID, ObNewModIds::TEST))); int64_t pos = 0; LogWriteBuf write_buf; write_buf.push_back(buf, MAX_LOG_BUFFER_SIZE); diff --git a/mittest/mtlenv/storage/blocksstable/test_index_tree.cpp b/mittest/mtlenv/storage/blocksstable/test_index_tree.cpp index 71ce5e924..44389650b 100644 --- a/mittest/mtlenv/storage/blocksstable/test_index_tree.cpp +++ b/mittest/mtlenv/storage/blocksstable/test_index_tree.cpp @@ -969,7 +969,8 @@ TEST_F(TestIndexTree, test_merge_info_build_row) // test deep_copy of macro_meta with given allocator ObArenaAllocator arena_allocator; ObFIFOAllocator safe_allocator; - OK(safe_allocator.init(&arena_allocator, OB_MALLOC_BIG_BLOCK_SIZE)); + OK(safe_allocator.init(&arena_allocator, OB_MALLOC_BIG_BLOCK_SIZE, + ObMemAttr(OB_SERVER_TENANT_ID, ObNewModIds::TEST))); ObDataMacroBlockMeta *copy_meta = nullptr; ObDataMacroBlockMeta &large_meta = *merge_info_list->at(0); int64_t test_col_cnt = 100; diff --git a/mittest/mtlenv/storage/test_ls_tablet_service.cpp b/mittest/mtlenv/storage/test_ls_tablet_service.cpp index 46c30514f..c16384ac6 100644 --- a/mittest/mtlenv/storage/test_ls_tablet_service.cpp +++ b/mittest/mtlenv/storage/test_ls_tablet_service.cpp @@ -265,7 +265,7 @@ TEST_F(TestLSTabletService, test_serialize_tablet) int64_t tablet_length = orig_tablet->get_serialize_size(); int64_t pos = 0; - char *buf = static_cast(ob_malloc(tablet_length)); + char *buf = static_cast(ob_malloc(tablet_length, ObNewModIds::TEST)); ret = orig_tablet->serialize(buf, tablet_length, pos); ASSERT_EQ(OB_SUCCESS, ret); @@ -294,7 +294,7 @@ TEST_F(TestLSTabletService, test_serialize_linked_list_tablet) // serialize and deserialize linked list int64_t tablets_length = tablet_head->get_serialize_size(); int64_t se_pos = 0; - char *buf = static_cast(ob_malloc(tablets_length)); + char *buf = static_cast(ob_malloc(tablets_length, ObNewModIds::TEST)); ret = tablet_head->serialize(buf, tablets_length, se_pos); ASSERT_EQ(OB_SUCCESS, ret); @@ -335,7 +335,7 @@ TEST_F(TestLSTabletService, test_deserialize_tablet_with_allocator) // serialize and deserialize linked list int64_t tablets_length = tablet_head->get_serialize_size(); int64_t se_pos = 0; - char *buf = static_cast(ob_malloc(tablets_length)); + char *buf = static_cast(ob_malloc(tablets_length, ObNewModIds::TEST)); ret = tablet_head->serialize(buf, tablets_length, se_pos); ASSERT_EQ(OB_SUCCESS, ret); diff --git a/src/diagnose/lua/ob_lua_api.cpp b/src/diagnose/lua/ob_lua_api.cpp index 255a11662..560681804 100644 --- a/src/diagnose/lua/ob_lua_api.cpp +++ b/src/diagnose/lua/ob_lua_api.cpp @@ -104,7 +104,7 @@ static ObFIFOAllocator &get_global_allocator() { static ObFIFOAllocator allocator; if (OB_UNLIKELY(!allocator.is_inited())) { - IGNORE_RETURN allocator.init(&LuaAllocator::get_instance(), (1 << 13) - 8, default_memattr, 0, 0, INT64_MAX); + IGNORE_RETURN allocator.init(&LuaAllocator::get_instance(), (1 << 13) - 8, lib::ObMemAttr(OB_SERVER_TENANT_ID, "LuaAlloc"), 0, 0, INT64_MAX); } return allocator; } diff --git a/src/logservice/libobcdc/src/ob_concurrent_seq_queue.h b/src/logservice/libobcdc/src/ob_concurrent_seq_queue.h index 753363ef2..2640b954d 100644 --- a/src/logservice/libobcdc/src/ob_concurrent_seq_queue.h +++ b/src/logservice/libobcdc/src/ob_concurrent_seq_queue.h @@ -44,7 +44,7 @@ public: ObConcurrentSeqQueue(); ~ObConcurrentSeqQueue(); public: - int init(const int64_t queue_size, const ObMemAttr &memattr = default_memattr); + int init(const int64_t queue_size, const ObMemAttr &memattr); /// @retval OB_SUCCESS success /// @retval OB_TIMEOUT timeout /// @retval other value fail diff --git a/src/logservice/libobcdc/src/ob_log_meta_data_service.cpp b/src/logservice/libobcdc/src/ob_log_meta_data_service.cpp index 2ec899be9..cdc6d0a6c 100644 --- a/src/logservice/libobcdc/src/ob_log_meta_data_service.cpp +++ b/src/logservice/libobcdc/src/ob_log_meta_data_service.cpp @@ -289,7 +289,7 @@ int ObLogMetaDataService::read_meta_info_in_archive_log_( int64_t data_size = 0; share::SCN start_scn; - if (OB_ISNULL(data_dict_in_log_info_buffer = static_cast(ob_malloc(buffer_size)))) { + if (OB_ISNULL(data_dict_in_log_info_buffer = static_cast(ob_malloc(buffer_size, "DataDictMetaInf")))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("alloc buffer for datadict metainfo failed", KR(ret), K(buffer_size)); } else if (OB_FAIL(archive_dest.set(archive_dest_str))) { diff --git a/src/logservice/libobcdc/src/ob_log_meta_manager.h b/src/logservice/libobcdc/src/ob_log_meta_manager.h index c1b31d0b8..57ceb6573 100644 --- a/src/logservice/libobcdc/src/ob_log_meta_manager.h +++ b/src/logservice/libobcdc/src/ob_log_meta_manager.h @@ -448,8 +448,8 @@ ObLogMetaManager::MetaInfo::MetaInfo() : base_allocator_(common::ObModIds::OB_LOG_META_INFO), fifo_allocator_() { - fifo_allocator_.init(&base_allocator_, common::OB_MALLOC_NORMAL_BLOCK_SIZE); - fifo_allocator_.set_label(common::ObModIds::OB_LOG_META_INFO); + fifo_allocator_.init(&base_allocator_, common::OB_MALLOC_NORMAL_BLOCK_SIZE, + ObMemAttr(common::OB_SERVER_TENANT_ID, common::ObModIds::OB_LOG_META_INFO)); } template diff --git a/src/logservice/libobcdc/src/ob_seq_thread.h b/src/logservice/libobcdc/src/ob_seq_thread.h index fe1f71636..9538b181f 100644 --- a/src/logservice/libobcdc/src/ob_seq_thread.h +++ b/src/logservice/libobcdc/src/ob_seq_thread.h @@ -58,7 +58,7 @@ public: public: int init(const int64_t thread_num, const int64_t queue_size, - const ObMemAttr &memattr = default_memattr); + const ObMemAttr &memattr); void destroy(); public: diff --git a/src/logservice/palf/log_io_worker.cpp b/src/logservice/palf/log_io_worker.cpp index 7fbc532ba..cfd44e3a9 100644 --- a/src/logservice/palf/log_io_worker.cpp +++ b/src/logservice/palf/log_io_worker.cpp @@ -256,7 +256,7 @@ int LogIOWorker::BatchLogIOFlushLogTaskMgr::init(int64_t batch_width, PALF_LOG(ERROR, "batch_io_task_array_ init failed", K(ret)); } else { for (int i = 0; i < batch_width && OB_SUCC(ret); i++) { - char *ptr = reinterpret_cast(mtl_malloc(sizeof(BatchLogIOFlushLogTask))); + char *ptr = reinterpret_cast(mtl_malloc(sizeof(BatchLogIOFlushLogTask), "LogIOTask")); BatchLogIOFlushLogTask *io_task = NULL; if (NULL == ptr) { ret = OB_ALLOCATE_MEMORY_FAILED; diff --git a/src/logservice/palf/palf_handle_impl.cpp b/src/logservice/palf/palf_handle_impl.cpp index a0ccbbe76..c2a0ef54c 100644 --- a/src/logservice/palf/palf_handle_impl.cpp +++ b/src/logservice/palf/palf_handle_impl.cpp @@ -4039,7 +4039,7 @@ int PalfHandleImpl::read_and_append_log_group_entry_before_ts_( } else if (FALSE_IT(last_log_buf_len = curr_group_entry.get_group_entry_size()) || FALSE_IT(last_log_start_lsn = curr_log_lsn)) { } else if (NULL == - (last_log_buf = static_cast(ob_malloc(last_log_buf_len)))) { + (last_log_buf = static_cast(ob_malloc(last_log_buf_len, "PalfHandleImpl")))) { tmp_ret = OB_ALLOCATE_MEMORY_FAILED; PALF_LOG(WARN, "alloc memory for last_log_buf in flashback failed", K(ret)); } else if (OB_TMP_FAIL(curr_group_entry.serialize(last_log_buf, last_log_buf_len, pos))) { diff --git a/src/observer/layer_perf/ob_layer_perf.cpp b/src/observer/layer_perf/ob_layer_perf.cpp index 5950e0c99..3959481fb 100644 --- a/src/observer/layer_perf/ob_layer_perf.cpp +++ b/src/observer/layer_perf/ob_layer_perf.cpp @@ -131,7 +131,7 @@ int ObLayerPerf::do_clog_layer_perf() palf::LSN lsn; share::SCN zero, ts_ns; LOG_INFO("perf layer append", KP(r_), KP(buf)); - if (nullptr == (cb = static_cast(ob_malloc(sizeof(PerfLogCb))))) { + if (nullptr == (cb = static_cast(ob_malloc(sizeof(PerfLogCb), "PerfLogCb")))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_ERROR("allo mem", K(ret)); } else if (FALSE_IT(new (cb) PerfLogCb(r_))) { diff --git a/src/observer/ob_inner_sql_connection.cpp b/src/observer/ob_inner_sql_connection.cpp index b0abb7a6c..59000a092 100644 --- a/src/observer/ob_inner_sql_connection.cpp +++ b/src/observer/ob_inner_sql_connection.cpp @@ -1409,7 +1409,7 @@ int ObInnerSQLConnection::request_table_lock_(const uint64_t tenant_id, char *tmp_str = nullptr; int64_t pos = 0; ObString sql; - if (OB_ISNULL(tmp_str = static_cast(ob_malloc(arg.get_serialize_size())))) { + if (OB_ISNULL(tmp_str = static_cast(ob_malloc(arg.get_serialize_size(), "LockTableReq")))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("alloc memory for sql_str failed", K(ret), K(arg.get_serialize_size())); } else if (OB_FAIL(arg.serialize(tmp_str, arg.get_serialize_size(), pos))) { @@ -1528,7 +1528,7 @@ int ObInnerSQLConnection::request_table_lock_(const uint64_t tenant_id, arg.lock_mode_ = lock_mode; arg.timeout_us_ = timeout_us; - if (OB_ISNULL(tmp_str = static_cast(ob_malloc(arg.get_serialize_size())))) { + if (OB_ISNULL(tmp_str = static_cast(ob_malloc(arg.get_serialize_size(), "LockTableReq")))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("alloc memory for sql_str failed", K(ret), K(arg.get_serialize_size())); } else if (OB_FAIL(arg.serialize(tmp_str, arg.get_serialize_size(), pos))) { @@ -1545,7 +1545,7 @@ int ObInnerSQLConnection::request_table_lock_(const uint64_t tenant_id, arg.lock_mode_ = lock_mode; arg.timeout_us_ = timeout_us; - if (OB_ISNULL(tmp_str = static_cast(ob_malloc(arg.get_serialize_size())))) { + if (OB_ISNULL(tmp_str = static_cast(ob_malloc(arg.get_serialize_size(), "LockTableReq")))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("alloc memory for sql_str failed", K(ret), K(arg.get_serialize_size())); } else if (OB_FAIL(arg.serialize(tmp_str, arg.get_serialize_size(), pos))) { diff --git a/src/pl/ob_pl_allocator.h b/src/pl/ob_pl_allocator.h index 9221daa84..e76751cc0 100644 --- a/src/pl/ob_pl_allocator.h +++ b/src/pl/ob_pl_allocator.h @@ -51,7 +51,7 @@ public: virtual void *alloc(const int64_t size, const ObMemAttr &attr) override; virtual void *alloc(const int64_t size) override { - return alloc(size, default_memattr); + return alloc(size, ObMemAttr(MTL_ID(), ObModIds::OB_PL_TEMP)); } virtual void free(void *ptr) override { UNUSED(ptr); } virtual void reset(); diff --git a/src/rootserver/backup/ob_backup_task_scheduler.cpp b/src/rootserver/backup/ob_backup_task_scheduler.cpp index ebd25be8c..ecb5cf145 100644 --- a/src/rootserver/backup/ob_backup_task_scheduler.cpp +++ b/src/rootserver/backup/ob_backup_task_scheduler.cpp @@ -117,11 +117,11 @@ int ObBackupTaskSchedulerQueue::init( LOG_WARN("invalid argument", K(ret), K(bucket_num), K(rpc_proxy), K(task_scheduler)); } else if (OB_FAIL(task_map_.create(bucket_num, OB_BACKUP_TASK_SCHEDULER))) { LOG_WARN("fail to init task map", K(ret), K(bucket_num)); - } else if (OB_FAIL(task_allocator_.init(ObMallocAllocator::get_instance(), OB_MALLOC_MIDDLE_BLOCK_SIZE))) { + } else if (OB_FAIL(task_allocator_.init(ObMallocAllocator::get_instance(), OB_MALLOC_MIDDLE_BLOCK_SIZE, + ObMemAttr(common::OB_SERVER_TENANT_ID, OB_BACKUP_TASK_SCHEDULER)))) { LOG_WARN("fail to init task allocator", K(ret)); } else { max_size_ = max_size; - task_allocator_.set_label(OB_BACKUP_TASK_SCHEDULER); tenant_stat_map_ = &tenant_stat_map; server_stat_map_ = &server_stat_map; server_mgr_ = &server_manager; diff --git a/src/rootserver/ob_disaster_recovery_task.h b/src/rootserver/ob_disaster_recovery_task.h index 5554c827b..c85f7c5f3 100644 --- a/src/rootserver/ob_disaster_recovery_task.h +++ b/src/rootserver/ob_disaster_recovery_task.h @@ -184,7 +184,7 @@ public: skip_change_member_list_(false), generate_time_(common::ObTimeUtility::current_time()), priority_(ObDRTaskPriority::MAX_PRI), - comment_(""), + comment_("DRTask"), schedule_time_(0), execute_time_(0), task_id_() {} diff --git a/src/rootserver/ob_disaster_recovery_task_mgr.cpp b/src/rootserver/ob_disaster_recovery_task_mgr.cpp index 8fb21d06b..36d5863df 100644 --- a/src/rootserver/ob_disaster_recovery_task_mgr.cpp +++ b/src/rootserver/ob_disaster_recovery_task_mgr.cpp @@ -117,10 +117,10 @@ int ObDRTaskQueue::init( } else if (OB_FAIL(task_map_.create(bucket_num, "DRTaskQ"))) { LOG_WARN("fail to create task map", KR(ret), K(bucket_num)); } else if (OB_FAIL(task_alloc_.init( - ObMallocAllocator::get_instance(), OB_MALLOC_MIDDLE_BLOCK_SIZE))) { + ObMallocAllocator::get_instance(), OB_MALLOC_MIDDLE_BLOCK_SIZE, + ObMemAttr(common::OB_SERVER_TENANT_ID, "DRTaskQ")))) { LOG_WARN("fail to init task allocator", KR(ret)); } else { - task_alloc_.set_label("DRTaskQ"); config_ = &config; rpc_proxy_ = rpc_proxy; server_mgr_ = server_mgr; diff --git a/src/rootserver/ob_disaster_recovery_worker.cpp b/src/rootserver/ob_disaster_recovery_worker.cpp index 352e73186..78140ecfb 100644 --- a/src/rootserver/ob_disaster_recovery_worker.cpp +++ b/src/rootserver/ob_disaster_recovery_worker.cpp @@ -59,7 +59,7 @@ ObLSReplicaTaskDisplayInfo::ObLSReplicaTaskDisplayInfo() source_replica_type_(REPLICA_TYPE_FULL), source_replica_paxos_replica_number_(OB_INVALID_COUNT), execute_server_(), - comment_("") + comment_("LSReplicaTask") { } diff --git a/src/share/allocator/ob_reserve_arena.h b/src/share/allocator/ob_reserve_arena.h index 629d1118d..459406307 100644 --- a/src/share/allocator/ob_reserve_arena.h +++ b/src/share/allocator/ob_reserve_arena.h @@ -35,11 +35,12 @@ public: { reset(); } - virtual void *alloc(const int64_t size) override + virtual void *alloc(const int64_t size, const ObMemAttr &attr) override { - return alloc(size, default_memattr); + UNUSED(attr); + return alloc(size); } - virtual void* alloc(const int64_t size, const ObMemAttr &attr) override + virtual void* alloc(const int64_t size) override { void *p = NULL; if (size > MAX_RESERVE_SIZE - 1 - pos_) { diff --git a/src/share/ob_tenant_mgr.cpp b/src/share/ob_tenant_mgr.cpp index 1449f962c..768ce1d03 100644 --- a/src/share/ob_tenant_mgr.cpp +++ b/src/share/ob_tenant_mgr.cpp @@ -85,7 +85,7 @@ ObVirtualTenantManager::ObVirtualTenantManager() : tenant_map_(NULL), tenant_pool_(), allocator_(ObModIds::OB_TENANT_INFO), - memattr_(default_memattr), + memattr_(OB_SERVER_TENANT_ID, ObModIds::OB_TENANT_INFO), is_inited_(false) { } diff --git a/src/share/rc/ob_tenant_base.h b/src/share/rc/ob_tenant_base.h index 77866cc0c..c37884e17 100644 --- a/src/share/rc/ob_tenant_base.h +++ b/src/share/rc/ob_tenant_base.h @@ -605,7 +605,7 @@ inline ObTenantSwitchGuard _make_tenant_switch_guard() for (share::ObTenantSwitchGuard g = share::_make_tenant_switch_guard(); g.loop_num_ == 0; g.loop_num_++) \ if (OB_SUCC(g.switch_to(tenant_id))) - inline void *mtl_malloc(int64_t nbyte, const common::ObMemAttr & attr = default_memattr) + inline void *mtl_malloc(int64_t nbyte, const common::ObMemAttr &attr) { common::ObMemAttr inner_attr = attr; if (OB_SERVER_TENANT_ID == inner_attr.tenant_id_ && @@ -627,7 +627,7 @@ inline ObTenantSwitchGuard _make_tenant_switch_guard() return ob_free(ptr); } - inline void *mtl_malloc_align(int64_t alignment, int64_t nbyte, const common::ObMemAttr & attr = default_memattr) + inline void *mtl_malloc_align(int64_t alignment, int64_t nbyte, const common::ObMemAttr &attr) { common::ObMemAttr inner_attr = attr; if (OB_SERVER_TENANT_ID == inner_attr.tenant_id_ && diff --git a/src/share/schema/ob_schema_struct.h b/src/share/schema/ob_schema_struct.h index bc2a7b085..0fe7a53b8 100644 --- a/src/share/schema/ob_schema_struct.h +++ b/src/share/schema/ob_schema_struct.h @@ -1783,19 +1783,21 @@ public: virtual void* alloc(const int64_t sz) override { - return alloc(sz, common::default_memattr); + return NULL == allocator_ ? NULL : allocator_->alloc(sz); } virtual void* alloc(const int64_t sz, const common::ObMemAttr &attr) override { - void *ret = NULL; - if (allocator_) { - ret = allocator_->alloc(sz, attr); - } - return ret; + return NULL == allocator_ ? NULL : allocator_->alloc(sz, attr); } - virtual void free(void *p) override { allocator_->free(p); } + virtual void free(void *p) override + { + if (allocator_) { + allocator_->free(p); + p = NULL; + } + } virtual ~ObSchemaAllocator() {}; private: common::ObIAllocator *allocator_; diff --git a/src/sql/das/ob_das_task_result.cpp b/src/sql/das/ob_das_task_result.cpp index 01624f104..6dd8f934e 100644 --- a/src/sql/das/ob_das_task_result.cpp +++ b/src/sql/das/ob_das_task_result.cpp @@ -165,7 +165,7 @@ int ObDASTaskResultMgr::save_task_result(int64_t task_id, bool added = false; if (is_vectorized) { void *buf = NULL; - if (OB_ISNULL(buf = ob_malloc(sizeof(ObChunkDatumStore::StoredRow *) * max_batch_size))) { + if (OB_ISNULL(buf = ob_malloc(sizeof(ObChunkDatumStore::StoredRow *) * max_batch_size, "DASTaskResMgr"))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("alloc stored row array failed", KR(ret)); } else { @@ -177,7 +177,7 @@ int ObDASTaskResultMgr::save_task_result(int64_t task_id, } else if (OB_FAIL(datum_store.init(4 * 1024 * 1024, // 4MB MTL_ID(), common::ObCtxIds::DEFAULT_CTX_ID, - "ObDASTaskResultMgr", + "DASTaskResMgr", true))) { LOG_WARN("init datum store failed", KR(ret)); } else if (OB_FAIL(datum_store.alloc_dir_id())) { @@ -374,7 +374,7 @@ int ObDASTaskResultMgr::iterator_task_result(int64_t task_id, && OB_FAIL(datum_store.init(INT64_MAX, MTL_ID(), common::ObCtxIds::DEFAULT_CTX_ID, - "ObDASTaskResultMgr", + "DASTaskResMgr", false))) { LOG_WARN("init datum store failed", KR(ret)); } else { diff --git a/src/sql/dtl/ob_dtl_local_first_buffer_manager.cpp b/src/sql/dtl/ob_dtl_local_first_buffer_manager.cpp index b27d895e2..1539ed932 100644 --- a/src/sql/dtl/ob_dtl_local_first_buffer_manager.cpp +++ b/src/sql/dtl/ob_dtl_local_first_buffer_manager.cpp @@ -204,10 +204,10 @@ int ObDtlBufferInfoManager::ObDtlBufferInfoAllocator::init() int ret = OB_SUCCESS; if (OB_FAIL(allocator_.init( lib::ObMallocAllocator::get_instance(), - OB_MALLOC_NORMAL_BLOCK_SIZE))) { + OB_MALLOC_NORMAL_BLOCK_SIZE, + ObMemAttr(common::OB_SERVER_TENANT_ID, "DTLBufAlloc")))) { LOG_WARN("failed to init alocator", K(ret)); } else { - allocator_.set_label("DTLBufAlloc"); free_list_.reset(); } return ret; @@ -360,10 +360,10 @@ int ObDtlLocalFirstBufferCacheManager::init() int ret = OB_SUCCESS; if (OB_FAIL(allocator_.init( lib::ObMallocAllocator::get_instance(), - OB_MALLOC_NORMAL_BLOCK_SIZE))) { + OB_MALLOC_NORMAL_BLOCK_SIZE, + ObMemAttr(common::OB_SERVER_TENANT_ID, ObModIds::OB_SQL_DTL)))) { LOG_WARN("failed to init allocator", K(ret)); } else { - allocator_.set_label(ObModIds::OB_SQL_DTL); if (OB_FAIL(hash_table_.init(BUCKET_NUM, CONCURRENT_CNT))) { LOG_WARN("failed to init hash table", K(ret)); } else if (OB_FAIL(buffer_info_mgr_.init())) { diff --git a/src/sql/engine/ob_tenant_sql_memory_manager.cpp b/src/sql/engine/ob_tenant_sql_memory_manager.cpp index 5b51e1326..63646c380 100644 --- a/src/sql/engine/ob_tenant_sql_memory_manager.cpp +++ b/src/sql/engine/ob_tenant_sql_memory_manager.cpp @@ -337,10 +337,10 @@ int ObTenantSqlMemoryManager::mtl_init(ObTenantSqlMemoryManager *&sql_mem_mgr) LOG_WARN("failed to alloc tenant sql memory manager", K(ret)); } else if (OB_FAIL(sql_mem_mgr->allocator_.init( lib::ObMallocAllocator::get_instance(), - OB_MALLOC_NORMAL_BLOCK_SIZE))) { + OB_MALLOC_NORMAL_BLOCK_SIZE, + ObMemAttr(common::OB_SERVER_TENANT_ID, "SqlMemMgr")))) { LOG_WARN("failed to init fifo allocator", K(ret)); } else { - sql_mem_mgr->allocator_.set_label("SqlMemMgr"); int64_t work_area_interval_size = sizeof(ObSqlWorkAreaInterval) * INTERVAL_NUM; sql_mem_mgr->wa_intervals_ = reinterpret_cast( sql_mem_mgr->allocator_.alloc(work_area_interval_size)); diff --git a/src/storage/backup/ob_backup_ctx.cpp b/src/storage/backup/ob_backup_ctx.cpp index 07d0fb988..2bf5c7be4 100644 --- a/src/storage/backup/ob_backup_ctx.cpp +++ b/src/storage/backup/ob_backup_ctx.cpp @@ -269,7 +269,7 @@ ObBackupFileWriteCtx::ObBackupFileWriteCtx() max_file_size_(0), io_fd_(), dev_handle_(NULL), - data_buffer_(), + data_buffer_("BackupCtx"), bandwidth_throttle_(NULL) {} @@ -399,6 +399,7 @@ ObBackupDataCtx::ObBackupDataCtx() macro_index_buffer_node_(), meta_index_buffer_node_(), file_trailer_(), + tmp_buffer_("BackupCtx"), bandwidth_throttle_(NULL) {} diff --git a/src/storage/backup/ob_backup_index_merger.cpp b/src/storage/backup/ob_backup_index_merger.cpp index dff8d1ed6..e305d5491 100644 --- a/src/storage/backup/ob_backup_index_merger.cpp +++ b/src/storage/backup/ob_backup_index_merger.cpp @@ -159,7 +159,7 @@ ObIBackupMultiLevelIndexBuilder::ObIBackupMultiLevelIndexBuilder() root_(NULL), write_ctx_(NULL), allocator_(), - buffer_writer_() + buffer_writer_("BackupIndMerger") {} ObIBackupMultiLevelIndexBuilder::~ObIBackupMultiLevelIndexBuilder() @@ -479,7 +479,7 @@ int ObIBackupMultiLevelIndexBuilder::get_index_tree_height_(int64_t &height) con int ObIBackupMultiLevelIndexBuilder::flush_trailer_() { int ret = OB_SUCCESS; - ObSelfBufferWriter buffer_writer; + ObSelfBufferWriter buffer_writer("BackupInd"); ObBackupMultiLevelIndexTrailer *trailer = NULL; const int64_t trailer_len = sizeof(ObBackupMultiLevelIndexTrailer); int64_t tree_height = 0; @@ -532,7 +532,7 @@ ObIBackupIndexMerger::ObIBackupIndexMerger() : is_inited_(false), merge_param_(), offset_(), - buffer_writer_(), + buffer_writer_("BackupIndMerger"), dev_handle_(NULL), io_fd_(), write_ctx_(), diff --git a/src/storage/backup/ob_backup_reader.cpp b/src/storage/backup/ob_backup_reader.cpp index 5966d2840..06a223802 100644 --- a/src/storage/backup/ob_backup_reader.cpp +++ b/src/storage/backup/ob_backup_reader.cpp @@ -479,7 +479,7 @@ ObITabletMetaBackupReader::~ObITabletMetaBackupReader() /* ObTabletMetaBackupReader */ -ObTabletMetaBackupReader::ObTabletMetaBackupReader() : ObITabletMetaBackupReader(), buffer_writer_() +ObTabletMetaBackupReader::ObTabletMetaBackupReader() : ObITabletMetaBackupReader(), buffer_writer_("BackupReader") {} ObTabletMetaBackupReader::~ObTabletMetaBackupReader() @@ -537,7 +537,7 @@ int ObTabletMetaBackupReader::get_meta_data(blocksstable::ObBufferReader &buffer /* ObSSTableMetaBackupReader */ -ObSSTableMetaBackupReader::ObSSTableMetaBackupReader() : ObITabletMetaBackupReader(), sstable_array_(), buffer_writer_() +ObSSTableMetaBackupReader::ObSSTableMetaBackupReader() : ObITabletMetaBackupReader(), sstable_array_(), buffer_writer_("BackupReader") {} ObSSTableMetaBackupReader::~ObSSTableMetaBackupReader() @@ -632,7 +632,7 @@ int ObSSTableMetaBackupReader::get_macro_block_id_list_( /* ObTabletPhysicalIDMetaBackupReader */ ObTabletPhysicalIDMetaBackupReader::ObTabletPhysicalIDMetaBackupReader() - : is_inited_(false), ctx_(NULL), tablet_id_(), buffer_writer_() + : is_inited_(false), ctx_(NULL), tablet_id_(), buffer_writer_("BackupReader") {} ObTabletPhysicalIDMetaBackupReader::~ObTabletPhysicalIDMetaBackupReader() diff --git a/src/storage/backup/ob_backup_tmp_file.cpp b/src/storage/backup/ob_backup_tmp_file.cpp index f822eb708..0d9c4a79f 100644 --- a/src/storage/backup/ob_backup_tmp_file.cpp +++ b/src/storage/backup/ob_backup_tmp_file.cpp @@ -112,7 +112,7 @@ ObBackupIndexBufferNode::ObBackupIndexBufferNode() next_(NULL), read_count_(0), write_count_(0), - buffer_writer_() + buffer_writer_("BackupTmpFile") {} ObBackupIndexBufferNode::~ObBackupIndexBufferNode() diff --git a/src/storage/blocksstable/encoding/ob_micro_block_encoder.cpp b/src/storage/blocksstable/encoding/ob_micro_block_encoder.cpp index 7174c693e..efd91912d 100644 --- a/src/storage/blocksstable/encoding/ob_micro_block_encoder.cpp +++ b/src/storage/blocksstable/encoding/ob_micro_block_encoder.cpp @@ -92,7 +92,7 @@ int ObMicroBlockEncoder::try_encoder(ObIColumnEncoder *&encoder, const int64_t c } ObMicroBlockEncoder::ObMicroBlockEncoder() : ctx_(), header_(NULL), - data_buffer_(0, blocksstable::OB_ENCODING_LABEL_DATA_BUFFER), + data_buffer_(blocksstable::OB_ENCODING_LABEL_DATA_BUFFER), datum_rows_(), all_col_datums_(), buffered_rows_checksum_(0), estimate_size_(0), estimate_size_limit_(0), header_size_(0), expand_pct_(DEFAULT_ESTIMATE_REAL_SIZE_PCT), diff --git a/src/storage/blocksstable/encoding/ob_micro_block_encoder.h b/src/storage/blocksstable/encoding/ob_micro_block_encoder.h index f34712b11..2e5242495 100644 --- a/src/storage/blocksstable/encoding/ob_micro_block_encoder.h +++ b/src/storage/blocksstable/encoding/ob_micro_block_encoder.h @@ -52,9 +52,6 @@ public: // int ObMacroBlockWriter::get_current_micro_block_buffer(const char *&buf, int64_t &size) static const int64_t DEFAULT_DATA_BUFFER_SIZE = common::OB_DEFAULT_MACRO_BLOCK_SIZE; - // For rowkey_buffer_, length, must great than OB_MAX_ROW_KEY_LENGTH - static const int64_t DEFAULT_ROWKEY_BUFFER_SIZE = 20 * 1024; - struct CellCopyIndex { uint32_t index_; @@ -155,7 +152,6 @@ private: ObMicroBlockEncodingCtx ctx_; ObMicroBlockHeader *header_; ObSelfBufferWriter data_buffer_; - ObSelfBufferWriter rowkey_buffer_; ObConstDatumRowArray datum_rows_; common::ObArray all_col_datums_; int64_t buffered_rows_checksum_; diff --git a/src/storage/blocksstable/ob_bloom_filter_data_writer.cpp b/src/storage/blocksstable/ob_bloom_filter_data_writer.cpp index 51b6965ee..5729ee97a 100644 --- a/src/storage/blocksstable/ob_bloom_filter_data_writer.cpp +++ b/src/storage/blocksstable/ob_bloom_filter_data_writer.cpp @@ -24,7 +24,7 @@ namespace blocksstable { ObBloomFilterMicroBlockWriter::ObBloomFilterMicroBlockWriter() : bf_micro_header_(NULL), - data_buffer_(0, ObModIds::OB_BF_DATA_WRITER, false), + data_buffer_(ObModIds::OB_BF_DATA_WRITER), is_inited_(false) { } @@ -123,7 +123,7 @@ int ObBloomFilterMicroBlockWriter::write(const ObBloomFilterCacheValue &bf_cache } ObBloomFilterMacroBlockWriter::ObBloomFilterMacroBlockWriter() - : data_buffer_(0, ObModIds::OB_BF_DATA_WRITER, false), + : data_buffer_(ObModIds::OB_BF_DATA_WRITER), bf_macro_header_(NULL), common_header_(), compressor_(), diff --git a/src/storage/blocksstable/ob_data_buffer.cpp b/src/storage/blocksstable/ob_data_buffer.cpp index 0c363d1d1..e87ec8713 100644 --- a/src/storage/blocksstable/ob_data_buffer.cpp +++ b/src/storage/blocksstable/ob_data_buffer.cpp @@ -23,7 +23,7 @@ namespace oceanbase namespace blocksstable { ObSelfBufferWriter::ObSelfBufferWriter( - const int64_t size, const char *label, const bool need_align) + const char *label, const int64_t size, const bool need_align) : ObBufferWriter(NULL, 0, 0), label_(label), is_aligned_(need_align), macro_block_mem_ctx_() { diff --git a/src/storage/blocksstable/ob_data_buffer.h b/src/storage/blocksstable/ob_data_buffer.h index 88e0ab82f..1949cc8f4 100644 --- a/src/storage/blocksstable/ob_data_buffer.h +++ b/src/storage/blocksstable/ob_data_buffer.h @@ -349,8 +349,8 @@ public: public: ObSelfBufferWriter( + const char *label, const int64_t size = 0, - const char *label = 0, const bool need_align = false); virtual ~ObSelfBufferWriter(); int ensure_space(const int64_t size); diff --git a/src/storage/blocksstable/ob_macro_block.cpp b/src/storage/blocksstable/ob_macro_block.cpp index 4c1109e5e..0ad39e505 100644 --- a/src/storage/blocksstable/ob_macro_block.cpp +++ b/src/storage/blocksstable/ob_macro_block.cpp @@ -372,8 +372,8 @@ ObMicroBlockCompressor::ObMicroBlockCompressor() : is_none_(false), micro_block_size_(0), compressor_(NULL), - comp_buf_(0, "MicrBlocComp"), - decomp_buf_(0, "MicrBlocDecomp") + comp_buf_("MicrBlocComp"), + decomp_buf_("MicrBlocDecomp") { } @@ -478,7 +478,7 @@ int ObMicroBlockCompressor::decompress(const char *in, const int64_t in_size, */ ObMacroBlock::ObMacroBlock() : spec_(NULL), - data_(0, "MacrBlocData"), + data_("MacrBlocData"), macro_header_(), data_base_offset_(0), last_rowkey_(), diff --git a/src/storage/blocksstable/ob_micro_block_writer.cpp b/src/storage/blocksstable/ob_micro_block_writer.cpp index ea855852c..6bf229733 100644 --- a/src/storage/blocksstable/ob_micro_block_writer.cpp +++ b/src/storage/blocksstable/ob_micro_block_writer.cpp @@ -24,8 +24,8 @@ ObMicroBlockWriter::ObMicroBlockWriter() :micro_block_size_limit_(0), column_count_(0), rowkey_column_count_(0), - data_buffer_(0, "MicrBlocWriter", false), - index_buffer_(0, "MicrBlocWriter", false), + data_buffer_("MicrBlocWriter"), + index_buffer_("MicrBlocWriter"), col_desc_array_(nullptr), need_calc_column_chksum_(false), is_inited_(false) diff --git a/src/storage/direct_load/ob_direct_load_sstable_builder.cpp b/src/storage/direct_load/ob_direct_load_sstable_builder.cpp index 5a560f9e5..7db6b8093 100644 --- a/src/storage/direct_load/ob_direct_load_sstable_builder.cpp +++ b/src/storage/direct_load/ob_direct_load_sstable_builder.cpp @@ -336,7 +336,7 @@ int ObDirectLoadDataBlockWriter2::write_large_item(const ObDirectLoadExternalRow int ret = OB_SUCCESS; char *new_buf; const int64_t align_buf_size = upper_align(new_buf_size, DIO_ALIGN_SIZE); - if (OB_ISNULL(new_buf = static_cast(ob_malloc(align_buf_size)))) { + if (OB_ISNULL(new_buf = static_cast(ob_malloc(align_buf_size, ObModIds::OB_SQL_LOAD_DATA)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("fail to allocate buffer", KR(ret), K(align_buf_size)); } else { diff --git a/src/storage/direct_load/ob_direct_load_sstable_scanner.cpp b/src/storage/direct_load/ob_direct_load_sstable_scanner.cpp index c78acc36a..376111862 100644 --- a/src/storage/direct_load/ob_direct_load_sstable_scanner.cpp +++ b/src/storage/direct_load/ob_direct_load_sstable_scanner.cpp @@ -378,7 +378,7 @@ int ObDirectLoadSSTableScanner::read_buffer(uint64_t offset, uint64_t size) int64_t read_size = size; if (large_buf_ == nullptr) { int64_t large_buf_size = OB_SERVER_BLOCK_MGR.get_macro_block_size(); - if (OB_ISNULL(large_buf_ = static_cast(ob_malloc(large_buf_size)))) { + if (OB_ISNULL(large_buf_ = static_cast(ob_malloc(large_buf_size, ObModIds::OB_SQL_LOAD_DATA)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("fail to allocate buffer", KR(ret), K(large_buf_size)); } @@ -393,7 +393,7 @@ int ObDirectLoadSSTableScanner::read_buffer(uint64_t offset, uint64_t size) int ObDirectLoadSSTableScanner::get_large_buffer(int64_t buf_size) { int ret = OB_SUCCESS; - if (OB_ISNULL(large_buf_ = static_cast(ob_malloc(buf_size)))) { + if (OB_ISNULL(large_buf_ = static_cast(ob_malloc(buf_size, ObModIds::OB_SQL_LOAD_DATA)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("fail to allocate buffer", KR(ret), K(buf_size)); } else { diff --git a/src/storage/high_availability/ob_storage_ha_reader.cpp b/src/storage/high_availability/ob_storage_ha_reader.cpp index 88e54c760..d3bbab17d 100644 --- a/src/storage/high_availability/ob_storage_ha_reader.cpp +++ b/src/storage/high_availability/ob_storage_ha_reader.cpp @@ -508,7 +508,7 @@ int ObCopyMacroBlockRestoreReader::get_next_macro_block( /******************ObCopyMacroBlockHandle*********************/ ObCopyMacroBlockHandle::ObCopyMacroBlockHandle() : is_reuse_macro_block_(false), - end_key_buf_(), + end_key_buf_("CMacBlockHandle"), read_handle_() { } diff --git a/src/storage/high_availability/ob_storage_ha_tablet_builder.cpp b/src/storage/high_availability/ob_storage_ha_tablet_builder.cpp index b6584d88c..23d73cae2 100644 --- a/src/storage/high_availability/ob_storage_ha_tablet_builder.cpp +++ b/src/storage/high_availability/ob_storage_ha_tablet_builder.cpp @@ -244,7 +244,7 @@ int ObStorageHATabletsBuilder::get_tablet_info_restore_reader_(ObICopyTabletInfo } else if (!param_.is_leader_restore_) { ret = OB_INVALID_ARGUMENT; LOG_WARN("get tablet info restore reader get invalid argument", K(ret), K(param_)); - } else if (FALSE_IT(buf = ob_malloc(sizeof(ObCopyTabletInfoRestoreReader)))) { + } else if (FALSE_IT(buf = ob_malloc(sizeof(ObCopyTabletInfoRestoreReader), "TabletReader"))) { } else if (OB_ISNULL(buf)) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc memory", K(ret), KP(buf)); @@ -470,7 +470,7 @@ int ObStorageHATabletsBuilder::get_tablets_sstable_restore_reader_(ObICopySSTabl } else if (!param_.is_leader_restore_) { ret = OB_INVALID_ARGUMENT; LOG_WARN("get tablets sstable restore reader get invalid argument", K(ret), K(param_)); - } else if (FALSE_IT(buf = ob_malloc(sizeof(ObCopySSTableInfoRestoreReader)))) { + } else if (FALSE_IT(buf = ob_malloc(sizeof(ObCopySSTableInfoRestoreReader), "TabletReader"))) { } else if (OB_ISNULL(buf)) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to alloc memory", K(ret), KP(buf)); diff --git a/src/storage/ob_tenant_tablet_stat_mgr.cpp b/src/storage/ob_tenant_tablet_stat_mgr.cpp index e2a211698..2afa69294 100644 --- a/src/storage/ob_tenant_tablet_stat_mgr.cpp +++ b/src/storage/ob_tenant_tablet_stat_mgr.cpp @@ -370,7 +370,8 @@ int ObTabletStreamPool::init( } else if (max_free_list_num <= 0 || max_dynamic_node_num < 0) { ret = OB_INVALID_ARGUMENT; LOG_WARN("get invalid argument", K(ret), K(max_free_list_num), K(max_dynamic_node_num)); - } else if (OB_FAIL(dynamic_allocator_.init(ObMallocAllocator::get_instance(), OB_MALLOC_NORMAL_BLOCK_SIZE))) { + } else if (OB_FAIL(dynamic_allocator_.init(ObMallocAllocator::get_instance(), OB_MALLOC_NORMAL_BLOCK_SIZE, + ObMemAttr(MTL_ID(), LABEL)))) { LOG_WARN("failed to init fifo allocator", K(ret)); } else if (OB_FAIL(free_list_.init(max_free_list_num, &free_list_allocator_))) { LOG_WARN("failed to init free list", K(ret), K(max_free_list_num)); @@ -378,7 +379,6 @@ int ObTabletStreamPool::init( ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("failed to allocate memory for stream node in free list", K(ret), K(max_free_list_num)); } else { - dynamic_allocator_.set_label(LABEL); ObTabletStreamNode *node = nullptr; for (int64_t i = 0; OB_SUCC(ret) && i < max_free_list_num; ++i) { node = new (buf + i) ObTabletStreamNode(FIXED_ALLOC); diff --git a/src/storage/restore/ob_ls_restore_handler.cpp b/src/storage/restore/ob_ls_restore_handler.cpp index 470ce9c9b..9528229d1 100644 --- a/src/storage/restore/ob_ls_restore_handler.cpp +++ b/src/storage/restore/ob_ls_restore_handler.cpp @@ -68,10 +68,10 @@ int ObLSRestoreHandler::init(ObLS *ls) } else if (OB_ISNULL(ls)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("nullptr ls", K(ret)); - } else if (OB_FAIL(allocator_.init(ObMallocAllocator::get_instance(), OB_MALLOC_MIDDLE_BLOCK_SIZE))) { + } else if (OB_FAIL(allocator_.init(ObMallocAllocator::get_instance(), OB_MALLOC_MIDDLE_BLOCK_SIZE, + ObMemAttr(common::OB_SERVER_TENANT_ID, OB_LS_RESTORE_HANDLER)))) { LOG_WARN("fail to init allocator", K(ret)); } else { - allocator_.set_label(OB_LS_RESTORE_HANDLER); ls_ = ls; rebuild_seq_ = ls->get_rebuild_seq(); is_inited_ = true; diff --git a/src/storage/tablelock/ob_obj_lock.h b/src/storage/tablelock/ob_obj_lock.h index 2a071ba3c..ec3463a00 100644 --- a/src/storage/tablelock/ob_obj_lock.h +++ b/src/storage/tablelock/ob_obj_lock.h @@ -313,7 +313,7 @@ class ObOBJLockMap public: ObOBJLockMap() : lock_map_(), - allocator_(), + allocator_("ObOBJLockMap"), is_inited_(false) {} int init(); diff --git a/src/storage/tx/ob_trans_deadlock_adapter.cpp b/src/storage/tx/ob_trans_deadlock_adapter.cpp index 469eb2fdf..a3769e8b9 100644 --- a/src/storage/tx/ob_trans_deadlock_adapter.cpp +++ b/src/storage/tx/ob_trans_deadlock_adapter.cpp @@ -789,7 +789,7 @@ int ObTransDeadlockDetectorAdapter::autonomous_register_to_deadlock(const ObTran ObSharedGuard ptr; ptr.assign((char*)"detector", [](char*){}); report_info.set_module_name(ptr); - char *buffer = (char *)ob_malloc(sizeof(char) * 64); + char *buffer = (char *)ob_malloc(sizeof(char) * 64, "DeadLockDA"); if (OB_NOT_NULL(buffer)) { last_trans_id.to_string(buffer, 64); buffer[63] = '\0'; diff --git a/src/storage/tx/ob_tx_api.cpp b/src/storage/tx/ob_tx_api.cpp index 8d8d9f1fe..41bd4a5e1 100644 --- a/src/storage/tx/ob_tx_api.cpp +++ b/src/storage/tx/ob_tx_api.cpp @@ -1491,7 +1491,7 @@ inline int ObTransService::rollback_savepoint_slowpath_(ObTxDesc &tx, ARRAY_FOREACH_NORET(parts, i) { if (parts[i].epoch_ <= 0) { int64_t len = tx.get_serialize_size() + sizeof(ObTxDesc); - char *buf = (char*)ob_malloc(len); + char *buf = (char*)ob_malloc(len, "TxDesc"); int64_t pos = sizeof(ObTxDesc); if (OB_FAIL(tx.serialize(buf, len, pos))) { TRANS_LOG(WARN, "serialize tx fail", KR(ret), K(tx)); diff --git a/src/storage/tx/ob_tx_msg.cpp b/src/storage/tx/ob_tx_msg.cpp index b681cc5ed..d171db619 100644 --- a/src/storage/tx/ob_tx_msg.cpp +++ b/src/storage/tx/ob_tx_msg.cpp @@ -95,7 +95,7 @@ OB_DEF_DESERIALIZE(ObTxRollbackSPMsg) bool has_tx_ptr = false; OB_UNIS_DECODE(has_tx_ptr); if (has_tx_ptr) { - void *buffer = ob_malloc(sizeof(ObTxDesc)); + void *buffer = ob_malloc(sizeof(ObTxDesc), "TxDesc"); if (OB_ISNULL(buffer)) { ret = OB_ALLOCATE_MEMORY_FAILED; } else { diff --git a/unittest/data_dictionary/test_data_dict_meta_info.cpp b/unittest/data_dictionary/test_data_dict_meta_info.cpp index 6c66a6d63..1baa533b4 100644 --- a/unittest/data_dictionary/test_data_dict_meta_info.cpp +++ b/unittest/data_dictionary/test_data_dict_meta_info.cpp @@ -32,7 +32,7 @@ TEST(ObDataDictMetaInfoItem, test_data_dict_meta_info_item) const int64_t __MB__ = 1L << 20; const int64_t item_cnt = 100; const int64_t buf_size = 2 * __MB__; - char *buf = static_cast(ob_malloc(buf_size)); + char *buf = static_cast(ob_malloc(buf_size, ObNewModIds::TEST)); int64_t pos = 0; DataDictMetaInfoItemArr item_arr; for (int64_t i = 0; i < item_cnt; i++) { @@ -54,7 +54,7 @@ TEST(ObDataDictMetaInfoHeader, test_data_dict_meta_info_header) ObRandom random; const int64_t __MB__ = 1L << 20; const int64_t buf_size = 2 * __MB__; - char *buf = static_cast(ob_malloc(buf_size)); + char *buf = static_cast(ob_malloc(buf_size, ObNewModIds::TEST)); header.magic_ = random.get_int32() && 0xFFFF; header.meta_version_ = 1; header.item_cnt_ = random.get_int32(); @@ -118,7 +118,7 @@ TEST(ObDataDictMetaInfo, test_data_dict_meta_info) EXPECT_EQ(meta_info_item_arr.at(i), item_arr.at(i)); } - char *new_buf = static_cast(ob_malloc(buffer_size)); + char *new_buf = static_cast(ob_malloc(buffer_size, ObNewModIds::TEST)); int64_t new_ser_pos = 0; EXPECT_EQ(OB_SUCCESS, meta_info.serialize(new_buf, buffer_size, new_ser_pos)); ObDataDictMetaInfo new_meta_info; diff --git a/unittest/libobcdc/test_ob_concurrent_seq_queue.cpp b/unittest/libobcdc/test_ob_concurrent_seq_queue.cpp index 4040dca7b..1edec9a8f 100644 --- a/unittest/libobcdc/test_ob_concurrent_seq_queue.cpp +++ b/unittest/libobcdc/test_ob_concurrent_seq_queue.cpp @@ -33,7 +33,7 @@ public: virtual void SetUp() { - ASSERT_EQ(0, queue_.init(1024)); + ASSERT_EQ(0, queue_.init(1024, ObMemAttr(OB_SERVER_TENANT_ID, ObNewModIds::TEST))); produce_seq_ = 0; consume_seq_ = 0; consume_thread_counter_ = 0; @@ -70,7 +70,7 @@ TEST_F(TestConSeqQueue, basic) ObConcurrentSeqQueue queue; void *data = 0; - EXPECT_EQ(0, queue.init(1024)); + EXPECT_EQ(0, queue.init(1024, ObMemAttr(OB_SERVER_TENANT_ID, ObNewModIds::TEST))); EXPECT_EQ(0, queue.push((void*)0, 0, 0)); EXPECT_EQ(0, queue.push((void*)1, 1, 0)); diff --git a/unittest/libobcdc/test_ob_log_dlist.cpp b/unittest/libobcdc/test_ob_log_dlist.cpp index 82bab4716..22041c5ec 100644 --- a/unittest/libobcdc/test_ob_log_dlist.cpp +++ b/unittest/libobcdc/test_ob_log_dlist.cpp @@ -68,7 +68,7 @@ public: void TestObLogDlist::generate_data(const int64_t count, Type *&datas) { - datas = (Type *)ob_malloc(sizeof(Type) * count); + datas = (Type *)ob_malloc(sizeof(Type) * count, ObNewModIds::TEST); OB_ASSERT(NULL != datas); for (int64_t idx = 0; idx < count; idx++) { new (datas + idx) Type(); diff --git a/unittest/libobcdc/test_ob_map_queue.cpp b/unittest/libobcdc/test_ob_map_queue.cpp index 80d948285..451f01d72 100644 --- a/unittest/libobcdc/test_ob_map_queue.cpp +++ b/unittest/libobcdc/test_ob_map_queue.cpp @@ -159,7 +159,7 @@ TEST_F(TestObMapQueue, push_pop_test) EXPECT_TRUE(map_queue.is_inited()); // malloc array - Type *array = (Type *)ob_malloc(sizeof(Type) * VALUE_COUNT); + Type *array = (Type *)ob_malloc(sizeof(Type) * VALUE_COUNT, ObNewModIds::TEST); OB_ASSERT(NULL != array); for (int64_t test_type = 0, test_cnt = 4; test_type < test_cnt; ++test_type) { @@ -344,7 +344,7 @@ TEST_F(TestObMapQueue, DISABLED_performance) TestPopWorker pop_workers[POP_THREAD_NUM]; // malloc array - Type *array = (Type *)ob_malloc(sizeof(Type) * VALUE_COUNT); + Type *array = (Type *)ob_malloc(sizeof(Type) * VALUE_COUNT, ObNewModIds::TEST); OB_ASSERT(NULL != array); memset(array, 0, sizeof(Type) * VALUE_COUNT); diff --git a/unittest/libobcdc/test_ob_map_queue_thread.cpp b/unittest/libobcdc/test_ob_map_queue_thread.cpp index a46279c2b..006217e9e 100644 --- a/unittest/libobcdc/test_ob_map_queue_thread.cpp +++ b/unittest/libobcdc/test_ob_map_queue_thread.cpp @@ -71,7 +71,7 @@ public: void TestObMapQueueThread::generate_data(const int64_t count, Type *&datas) { - datas = (Type *)ob_malloc(sizeof(Type) * count); + datas = (Type *)ob_malloc(sizeof(Type) * count, ObNewModIds::TEST); OB_ASSERT(NULL != datas); for (int64_t idx = 0; idx < count; idx++) { datas[idx].reset(idx, idx % THREAD_NUM); diff --git a/unittest/libobcdc/test_ob_seq_thread.cpp b/unittest/libobcdc/test_ob_seq_thread.cpp index bc598930e..05676da04 100644 --- a/unittest/libobcdc/test_ob_seq_thread.cpp +++ b/unittest/libobcdc/test_ob_seq_thread.cpp @@ -48,11 +48,12 @@ public: TEST_F(TestSeqThread, basic) { CThread thread; + ObMemAttr attr(OB_SERVER_TENANT_ID, ObNewModIds::TEST); // Parameter not legal - EXPECT_EQ(OB_INVALID_ARGUMENT, thread.init(257, 100)); - EXPECT_EQ(OB_INVALID_ARGUMENT, thread.init(0, 0)); + EXPECT_EQ(OB_INVALID_ARGUMENT, thread.init(257, 100, attr)); + EXPECT_EQ(OB_INVALID_ARGUMENT, thread.init(0, 0, attr)); - EXPECT_EQ(OB_SUCCESS, thread.init(256, 10000)); + EXPECT_EQ(OB_SUCCESS, thread.init(256, 10000, attr)); EXPECT_EQ(OB_SUCCESS, thread.start()); for (int64_t index = 0; index < 1000; index++) { EXPECT_EQ(OB_SUCCESS, thread.push((void*)(index + 1), index, 0)); diff --git a/unittest/logservice/test_log_sliding_window.cpp b/unittest/logservice/test_log_sliding_window.cpp index 8a42f9e6a..e898bc464 100644 --- a/unittest/logservice/test_log_sliding_window.cpp +++ b/unittest/logservice/test_log_sliding_window.cpp @@ -102,7 +102,7 @@ void TestLogSlidingWindow::SetUp() OB_ASSERT(FALSE); } alloc_mgr_ = new (buf) common::ObTenantMutilAllocator(tenant_id); - data_buf_ = (char*)ob_malloc(64 * 1024 * 1024); + data_buf_ = (char*)ob_malloc(64 * 1024 * 1024, attr); // init MTL ObTenantBase tbase(tenant_id); ObTenantEnv::set_tenant(&tbase); @@ -949,7 +949,7 @@ TEST_F(TestLogSlidingWindow, test_append_disk_log) // non-continous buf group_header.reset(); write_buf.reset(); - char *second_buf = (char *)ob_malloc(second_part_len); + char *second_buf = (char *)ob_malloc(second_part_len, ObNewModIds::TEST); EXPECT_TRUE(NULL != second_buf); memcpy(second_buf, data_buf_ + first_part_len, second_part_len); EXPECT_EQ(OB_SUCCESS, write_buf.push_back(data_buf_, first_part_len)); diff --git a/unittest/share/cache/ob_cache_test_utils.h b/unittest/share/cache/ob_cache_test_utils.h index 7d478f856..866872a0b 100644 --- a/unittest/share/cache/ob_cache_test_utils.h +++ b/unittest/share/cache/ob_cache_test_utils.h @@ -325,7 +325,7 @@ public: int ret = OB_SUCCESS; const int64_t buf_size = sizeof(task); void *ptr = NULL; - if (NULL == (ptr = ob_malloc(buf_size))) { + if (NULL == (ptr = ob_malloc(buf_size, ObNewModIds::TEST))) { ret = OB_ALLOCATE_MEMORY_FAILED; COMMON_LOG(WARN, "ob_malloc failed", K(ret), K(buf_size)); } else { diff --git a/unittest/share/deadlock/test_deadlock.cpp b/unittest/share/deadlock/test_deadlock.cpp index e0a764df4..6c97495fe 100644 --- a/unittest/share/deadlock/test_deadlock.cpp +++ b/unittest/share/deadlock/test_deadlock.cpp @@ -153,7 +153,8 @@ public: cout << "\n<<<<<<<<<<<<<<<<<<<<" << "start case" << case_num << ">>>>>>>>>>>>>>>>>>>>" << endl; // do not use rpc, will core dump // ASSERT_EQ(OB_SUCCESS, MTL(ObDeadLockDetectorMgr*)->init()); - oceancase::unittest::MockDeadLockRpc *rpc = (oceancase::unittest::MockDeadLockRpc *)ob_malloc(sizeof(oceancase::unittest::MockDeadLockRpc)); + oceancase::unittest::MockDeadLockRpc *rpc = (oceancase::unittest::MockDeadLockRpc *)ob_malloc(sizeof(oceancase::unittest::MockDeadLockRpc), + ObNewModIds::TEST); rpc = new (rpc) oceancase::unittest::MockDeadLockRpc(); MTL(ObDeadLockDetectorMgr*)->rpc_ = rpc; diff --git a/unittest/share/test_tenant_resource.cpp b/unittest/share/test_tenant_resource.cpp index 864ad363f..2e97693ce 100644 --- a/unittest/share/test_tenant_resource.cpp +++ b/unittest/share/test_tenant_resource.cpp @@ -279,7 +279,8 @@ TEST_F(TestTenantResource, mtl_switch) TEST_F(TestTenantResource, tenant_base_set) { - transaction::ObTransService* trans_service = (transaction::ObTransService*)ob_malloc(sizeof(transaction::ObTransService)); + transaction::ObTransService* trans_service = (transaction::ObTransService*)ob_malloc(sizeof(transaction::ObTransService), + ObNewModIds::TEST); ObTenantBase tenant_base(1); tenant_base.set(trans_service); ObTenantEnv::set_tenant(&tenant_base); diff --git a/unittest/sql/engine/load_data/ob_load_data_parser_test.cpp b/unittest/sql/engine/load_data/ob_load_data_parser_test.cpp index 0ce3cd0ee..9721b03c1 100644 --- a/unittest/sql/engine/load_data/ob_load_data_parser_test.cpp +++ b/unittest/sql/engine/load_data/ob_load_data_parser_test.cpp @@ -148,7 +148,7 @@ TEST_F(TestParser, general_parser) ObDataInFileStruct file_struct; file_struct.field_term_str_ = "|"; - void *temp_buf = (ob_malloc(OB_MALLOC_BIG_BLOCK_SIZE)); + void *temp_buf = (ob_malloc(OB_MALLOC_BIG_BLOCK_SIZE, ObNewModIds::TEST)); ASSERT_TRUE(temp_buf != NULL); ObLoadFileBuffer *buffer = new(temp_buf)ObLoadFileBuffer(OB_MALLOC_BIG_BLOCK_SIZE - sizeof(ObLoadFileBuffer) - 1024); @@ -228,11 +228,11 @@ TEST_F(TestParser, general_parser_escape) file_struct.field_enclosed_char_ = '"'; void *temp_buf = NULL; - temp_buf = (ob_malloc(OB_MALLOC_BIG_BLOCK_SIZE)); + temp_buf = (ob_malloc(OB_MALLOC_BIG_BLOCK_SIZE, ObNewModIds::TEST)); ASSERT_TRUE(temp_buf != NULL); ObLoadFileBuffer *buffer = new(temp_buf)ObLoadFileBuffer(OB_MALLOC_BIG_BLOCK_SIZE - sizeof(ObLoadFileBuffer) - 1024); - temp_buf = (ob_malloc(OB_MALLOC_BIG_BLOCK_SIZE)); + temp_buf = (ob_malloc(OB_MALLOC_BIG_BLOCK_SIZE, ObNewModIds::TEST)); ASSERT_TRUE(temp_buf != NULL); ObLoadFileBuffer *escape = new(temp_buf)ObLoadFileBuffer(OB_MALLOC_BIG_BLOCK_SIZE - sizeof(ObLoadFileBuffer) - 1024); diff --git a/unittest/storage/blocksstable/test_data_buffer.cpp b/unittest/storage/blocksstable/test_data_buffer.cpp index 73fd389e1..9ba3beb1a 100644 --- a/unittest/storage/blocksstable/test_data_buffer.cpp +++ b/unittest/storage/blocksstable/test_data_buffer.cpp @@ -66,8 +66,8 @@ TEST_F(TestDataBuffer, test_ObSelfBufferWriter) { int ret = OB_SUCCESS; int64_t big_size = 256L * 1024L * 1024L * 1024L * 1024L * 1024L;//256TB - ObSelfBufferWriter buf_align(4096, ObModIds::TEST, true); - ObSelfBufferWriter buf_not_align(0, ObModIds::TEST, false); + ObSelfBufferWriter buf_align(ObModIds::TEST, 4096, true); + ObSelfBufferWriter buf_not_align(ObModIds::TEST, 0, false); ret = buf_align.ensure_space(ALIGNED_SIZE); ASSERT_EQ(ret, OB_SUCCESS); diff --git a/unittest/storage/slog/test_storage_log_read_write.cpp b/unittest/storage/slog/test_storage_log_read_write.cpp index f224de84e..2882b00c4 100644 --- a/unittest/storage/slog/test_storage_log_read_write.cpp +++ b/unittest/storage/slog/test_storage_log_read_write.cpp @@ -226,7 +226,7 @@ TEST_F(TestStorageLogRW, test_basic) // test read multi-param normal-size log for (int i = 0; i < 10; i++) { disk_addr = param_arr.at(i).disk_addr_; - buf = ob_malloc(disk_addr.size_); + buf = ob_malloc(disk_addr.size_, ObNewModIds::TEST); ret = ObStorageLogReader::read_log(slogger_->get_dir(), disk_addr, disk_addr.size_, buf, pos, OB_SERVER_TENANT_ID); ASSERT_EQ(OB_SUCCESS, ret); cmp = MEMCMP(slog_arr1[i].buf_, (char *)buf + pos, data_len[i]); @@ -273,7 +273,7 @@ TEST_F(TestStorageLogRW, test_basic) // test read multi-param large-size log for (int i = 0; i < 10; i++) { disk_addr = param_arr2.at(i).disk_addr_; - buf = ob_malloc(disk_addr.size_); + buf = ob_malloc(disk_addr.size_, ObNewModIds::TEST); ret = ObStorageLogReader::read_log(slogger2->get_dir(), disk_addr, disk_addr.size_, buf, pos, OB_SERVER_TENANT_ID); ASSERT_EQ(OB_SUCCESS, ret); cmp = MEMCMP(slog_arr2[i].buf_, (char *)buf + pos, data_len[i]); diff --git a/unittest/storage/test_io_manager.cpp b/unittest/storage/test_io_manager.cpp index e24273bf7..5ff7d2a82 100644 --- a/unittest/storage/test_io_manager.cpp +++ b/unittest/storage/test_io_manager.cpp @@ -1610,7 +1610,7 @@ int IOPerfRunner::init(const int64_t absolute_ts, const IOPerfLoad &load) // prepare write buffer if (OB_SUCC(ret) && ObIOMode::WRITE == load_.mode_ && nullptr == write_buf_) { const int64_t buf_size = load_.size_ + DIO_READ_ALIGN_SIZE; - void *tmp_buf = ob_malloc(buf_size); + void *tmp_buf = ob_malloc(buf_size, ObNewModIds::TEST); if (nullptr == tmp_buf) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("allocate memory failed", K(ret), K(buf_size)); diff --git a/unittest/storage/tx/it/test_tx_free_route.cpp b/unittest/storage/tx/it/test_tx_free_route.cpp index 36c821fea..ccdaf5324 100644 --- a/unittest/storage/tx/it/test_tx_free_route.cpp +++ b/unittest/storage/tx/it/test_tx_free_route.cpp @@ -540,7 +540,7 @@ int MockObServer::assign_resp_tx_state_(ObResp &resp, ObTxDesc *tx_desc, ObTxnFr #define ENCODE_TX_STATE_(t) \ if (OB_SUCC(ret) && ctx.t##_changed_) { \ int64_t len = tx_node_.txn_free_route__get_##t##_state_serialize_size(tx_desc, ctx); \ - char *buf = (char*)ob_malloc(len); \ + char *buf = (char*)ob_malloc(len, ObMemAttr(OB_SERVER_TENANT_ID, ObNewModIds::TEST)); \ int64_t pos = 0; \ if (OB_FAIL(tx_node_.txn_free_route__serialize_##t##_state(session_.get_sessid(), tx_desc, ctx, buf, len, pos))) { \ TRANS_LOG(ERROR, "serialize fail", K(ret), K(tx_desc)); \ diff --git a/unittest/storage/tx/it/tx_node.cpp b/unittest/storage/tx/it/tx_node.cpp index b16e4dfb3..6a3651b2f 100644 --- a/unittest/storage/tx/it/tx_node.cpp +++ b/unittest/storage/tx/it/tx_node.cpp @@ -429,7 +429,7 @@ int ObTxNode::handle_msg_(MsgPack *pkt) ObTxFreeRoutePushStateResp resp; resp.ret_ = ret; int64_t buf_len = resp.get_serialize_size(); - char *buf = (char*)ob_malloc(buf_len); + char *buf = (char*)ob_malloc(buf_len, ObNewModIds::TEST); int64_t pos = 0; OZ(resp.serialize(buf, buf_len, pos)); pkt->resp_ = ObString(buf_len, buf); diff --git a/unittest/storage/tx/mock_utils/basic_fake_define.h b/unittest/storage/tx/mock_utils/basic_fake_define.h index 4341c3b4c..22c34326a 100644 --- a/unittest/storage/tx/mock_utils/basic_fake_define.h +++ b/unittest/storage/tx/mock_utils/basic_fake_define.h @@ -86,7 +86,7 @@ public: } virtual int alloc_undo_status_node(ObUndoStatusNode *&undo_status_node) override { - void *ptr = ob_malloc(TX_DATA_SLICE_SIZE); + void *ptr = ob_malloc(TX_DATA_SLICE_SIZE, ObNewModIds::TEST); undo_status_node = new (ptr) ObUndoStatusNode(); return OB_SUCCESS; } diff --git a/unittest/storage/tx/mock_utils/ob_fake_tx_rpc.h b/unittest/storage/tx/mock_utils/ob_fake_tx_rpc.h index da1589857..ae5612e48 100644 --- a/unittest/storage/tx/mock_utils/ob_fake_tx_rpc.h +++ b/unittest/storage/tx/mock_utils/ob_fake_tx_rpc.h @@ -108,7 +108,7 @@ public: { int ret = OB_SUCCESS; int64_t size = msg.get_serialize_size() + 1 /*for msg category*/ + sizeof(int16_t) /* for tx_msg.type_ */; - char *buf = (char*)ob_malloc(size); + char *buf = (char*)ob_malloc(size, ObNewModIds::TEST); buf[0] = 0; // 0 not callback msg int64_t pos = 1; int16_t msg_type = msg.type_; @@ -131,7 +131,7 @@ public: { int ret = OB_SUCCESS; int64_t size = msg.get_serialize_size() + 1 /*for msg category*/ + sizeof(int16_t) /* for tx_msg.type_ */; - char *buf = (char*)ob_malloc(size); + char *buf = (char*)ob_malloc(size, ObNewModIds::TEST); buf[0] = 0; // not callback msg int64_t pos = 1; int16_t msg_type = msg.type_; @@ -148,7 +148,7 @@ public: { int ret = OB_SUCCESS; int64_t size = msg.get_serialize_size() + 1 + sizeof(int16_t); - char *buf = (char*)ob_malloc(size); + char *buf = (char*)ob_malloc(size, ObNewModIds::TEST); buf[0] = 0; // not callback msg int64_t pos = 1; int16_t msg_type = TX_MSG_TYPE::TX_FREE_ROUTE_PUSH_STATE; @@ -180,7 +180,7 @@ int ObFakeTransRpc::send_msg_callback(const ObAddr &recv, int ret = OB_SUCCESS; TxMsgCallbackMsg rmsg(msg, addr_, rslt); int64_t size = rmsg.get_serialize_size() + 1 /* for msg_category */; - char *buf = (char*)ob_malloc(size); + char *buf = (char*)ob_malloc(size, ObNewModIds::TEST); buf[0] = 1;// callback int64_t pos = 1; OZ(rmsg.serialize(buf, size, pos)); diff --git a/unittest/storage/tx/test_ob_tx_log.cpp b/unittest/storage/tx/test_ob_tx_log.cpp index d6a747129..688c377fc 100644 --- a/unittest/storage/tx/test_ob_tx_log.cpp +++ b/unittest/storage/tx/test_ob_tx_log.cpp @@ -441,7 +441,7 @@ TEST_F(TestObTxLog, test_compat_bytes) K(fill_commit_info.get_serialize_size())); ASSERT_EQ(true, fill_commit_info.is_dup_tx()); ASSERT_EQ(false, fill_commit_info.get_participants().empty()); - void *tmp_buf = ob_malloc(1 * 1024 * 1024); + void *tmp_buf = ob_malloc(1 * 1024 * 1024, ObNewModIds::TEST); int64_t pos = 0; fill_commit_info.compat_bytes_.set_object_flag(2, false); fill_commit_info.compat_bytes_.set_object_flag(5, false);