[CP] [CP] fix MemLeak DeadLock

This commit is contained in:
obdev
2022-11-24 09:39:55 +00:00
committed by wangzelin.wzl
parent 145a4a87a6
commit 23ad5e6d1d
5 changed files with 38 additions and 18 deletions

View File

@ -178,7 +178,7 @@ void ObDumpTaskGenerator::dump_memory_leak()
LOG_WARN("alloc failed", K(ret));
} else {
common::ObMemLeakChecker::mod_info_map_t tmp_map;
if (OB_FAIL(tmp_map.create(1024, attr, attr))) {
if (OB_FAIL(tmp_map.create(1024))) {
LOG_WARN("create map failed", K(ret));
} else if (OB_FAIL(get_mem_leak_checker().load_leak_info_map(tmp_map))) {
LOG_WARN("load map failed", K(ret));
@ -191,7 +191,7 @@ void ObDumpTaskGenerator::dump_memory_leak()
get_mem_leak_checker().get_label(),
get_mem_leak_checker().get_check_type(),
ObTimeUtility::current_time());
for (auto it = tmp_map.begin(); it != tmp_map.end(); ++it) {
for (auto it = tmp_map->begin(); it != tmp_map->end(); ++it) {
pos += snprintf(buf + pos, buf_len - pos, "bt=%s, count=%ld, bytes=%ld\n",
it->first.bt_, it->second.first, it->second.second);
if (pos > buf_len / 2) {

View File

@ -62,19 +62,19 @@ int ObMemLeakCheckerInfo::inner_get_next_row(common::ObNewRow *&row)
if (OB_FAIL(sanity_check())) {
// error
} else if (!opened_) {
int ret = info_map_.create(10000, ObModIds::TEST);
int ret = info_map_.create(10000);
if (OB_FAIL(ret)) {
SERVER_LOG(WARN, "failed to create hashmap", K(ret));
} else if (OB_FAIL(leak_checker_->load_leak_info_map(info_map_))) {
SERVER_LOG(WARN, "failed to collection leak info", K(ret));
} else {
opened_ = true;
it_ = info_map_.begin();
it_ = info_map_->begin();
}
}
if (OB_SUCC(ret)) {
if (it_ != info_map_.end()) {
if (it_ != info_map_->end()) {
if (OB_FAIL(fill_row(row))) {
SERVER_LOG(WARN, "failed to fill row", K(ret));
}

View File

@ -46,7 +46,7 @@ private:
private:
bool opened_;
common::ObMemLeakChecker *leak_checker_;
common::ObMemLeakChecker::mod_info_map_t::const_iterator it_;
common::ObMemLeakChecker::mod_info_map_t::hashmap::const_iterator it_;
common::ObMemLeakChecker::mod_info_map_t info_map_;
common::ObAddr *addr_;
uint64_t tenant_id_;