disable construct of ObIAllocator

This commit is contained in:
nroskill
2022-02-10 20:06:48 +08:00
committed by LINxiansheng
parent 17b0f303d7
commit 9007c77b10
15 changed files with 92 additions and 50 deletions

View File

@ -87,7 +87,7 @@ public:
{
(void)set_data(buf_, MAX_MSGBUF_SIZE);
}
~ObElectionMsgBuffer()
virtual ~ObElectionMsgBuffer()
{}
TO_STRING_KV(K_(capacity), K_(position), K_(limit));

View File

@ -57,12 +57,16 @@ public:
ObSmallArena();
~ObSmallArena();
void *alloc_aligned(const int64_t size, const int64_t align);
void *alloc(const int64_t size, const common::ObMemAttr &attr)
virtual void *alloc(const int64_t size, const common::ObMemAttr &attr) override
{
UNUSEDx(attr);
return alloc(size);
}
void *alloc(const int64_t size);
virtual void *alloc(const int64_t size) override;
virtual void free(void *ptr) override
{
UNUSED(ptr);
}
void reset();
int64_t get_small_alloc_count() const;
int64_t get_large_alloc_count() const;

View File

@ -2173,12 +2173,12 @@ public:
ObSchemaAllocator(common::ObIAllocator &allocator) : allocator_(&allocator)
{}
virtual void *alloc(const int64_t sz)
virtual void* alloc(const int64_t sz) override
{
return alloc(sz, common::default_memattr);
}
virtual void *alloc(const int64_t sz, const common::ObMemAttr &attr)
virtual void* alloc(const int64_t sz, const common::ObMemAttr& attr) override
{
void *ret = NULL;
if (allocator_) {
@ -2187,6 +2187,10 @@ public:
return ret;
}
virtual void free(void *p) override
{
allocator_->free(p);
}
virtual ~ObSchemaAllocator(){};
private:

View File

@ -344,6 +344,15 @@ public:
{}
void* alloc(const int64_t size) override;
void* alloc(const int64_t size, const common::ObMemAttr& attr) override
{
UNUSED(attr);
return alloc(size);
}
void free(void* ptr) override
{
UNUSED(ptr);
}
private:
int64_t off_;

View File

@ -41,6 +41,15 @@ public:
}
virtual void* alloc(const int64_t size) override;
virtual void* alloc(const int64_t size, const common::ObMemAttr& attr) override
{
UNUSED(attr);
return alloc(size);
}
virtual void free(void* ptr) override
{
UNUSED(ptr);
}
private:
common::ObIAllocator* alloc_;

View File

@ -31,11 +31,16 @@ public:
int init(const int64_t obj_size, const char* label, uint64_t tenant_id_);
void* alloc(int64_t sz)
void* alloc(const int64_t sz) override
{
return alloc_(sz);
}
void free(void* ptr)
void* alloc(const int64_t size, const common::ObMemAttr& attr) override
{
UNUSED(attr);
return alloc(size);
}
void free(void* ptr) override
{
free_(ptr);
}

View File

@ -168,7 +168,7 @@ public:
ATOMIC_STORE(&free_count_, 0);
ATOMIC_STORE(&alloc_size_, 0);
}
void* alloc(const int64_t size)
void* alloc(const int64_t size) override
{
void* ret = nullptr;
if (OB_ISNULL(ret = allocator_.alloc(size))) {
@ -179,7 +179,12 @@ public:
}
return ret;
}
void free(void* ptr)
void* alloc(const int64_t size, const ObMemAttr& attr) override
{
UNUSED(attr);
return alloc(size);
}
void free(void* ptr) override
{
if (OB_ISNULL(ptr)) {
// do nothing
@ -244,7 +249,7 @@ public:
ATOMIC_STORE(&free_count_, 0);
ATOMIC_STORE(&alloc_size_, 0);
}
void* alloc(const int64_t size)
void* alloc(const int64_t size) override
{
void* ret = nullptr;
if (OB_ISNULL(ret = allocator_.alloc(size))) {
@ -255,7 +260,12 @@ public:
}
return ret;
}
void free(void* ptr)
void* alloc(const int64_t size, const ObMemAttr& attr) override
{
UNUSED(attr);
return alloc(size);
}
void free(void* ptr) override
{
if (OB_ISNULL(ptr)) {
// do nothing