fix get histogram memory leak and some failed cases

This commit is contained in:
wangt1xiuyi
2022-11-16 14:05:38 +00:00
committed by wangzelin.wzl
parent 6710671db5
commit dd96b22f55
3 changed files with 12 additions and 9 deletions

View File

@ -18,10 +18,10 @@
namespace oceanbase namespace oceanbase
{ {
namespace common namespace common
{ {
template <class T> template <class T>
class ObDITls class ObDITls
{ {
public: public:
@ -66,5 +66,5 @@ T* ObDITls<T>::get_instance()
} }
} }
} }
#endif #endif

View File

@ -89,7 +89,7 @@ public:
pop_count_(0) pop_count_(0)
{} {}
~ObHistogram() {} ~ObHistogram() { reset(); }
void reset(); void reset();
@ -219,7 +219,7 @@ public:
explicit ObOptColumnStat(common::ObIAllocator &allocator); explicit ObOptColumnStat(common::ObIAllocator &allocator);
~ObOptColumnStat() {} ~ObOptColumnStat() { histogram_.reset(); }
uint64_t get_table_id() const { return table_id_; } uint64_t get_table_id() const { return table_id_; }
void set_table_id(uint64_t tid) { table_id_ = tid; } void set_table_id(uint64_t tid) { table_id_ = tid; }

View File

@ -237,7 +237,10 @@ int ObOptStatService::load_column_stat_and_put_cache(const uint64_t tenant_id,
LOG_WARN("puts column stat into cache failed.", K(ret)); LOG_WARN("puts column stat into cache failed.", K(ret));
} else if (OB_FAIL(handles.push_back(handle))) { } else if (OB_FAIL(handles.push_back(handle))) {
LOG_WARN("failed to push back", K(ret)); LOG_WARN("failed to push back", K(ret));
} else {/*do nothing*/} } else {
key_column_stats.at(i).stat_->~ObOptColumnStat();
key_column_stats.at(i).stat_ = NULL;
}
} }
} }
return ret; return ret;