fix LSMap do not release QSync memory when destroied
This commit is contained in:
		@ -82,6 +82,11 @@ void ObLSLocationMap::destroy()
 | 
				
			|||||||
    ls_buckets_ = NULL;
 | 
					    ls_buckets_ = NULL;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (OB_NOT_NULL(buckets_lock_)) {
 | 
					  if (OB_NOT_NULL(buckets_lock_)) {
 | 
				
			||||||
 | 
					    for (int64_t i = 0; i < BUCKETS_CNT; ++i) {
 | 
				
			||||||
 | 
					      if (OB_NOT_NULL(buckets_lock_ + i)) {
 | 
				
			||||||
 | 
					        (buckets_lock_ + i)->~ObQSyncLock();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ob_free(buckets_lock_);
 | 
					    ob_free(buckets_lock_);
 | 
				
			||||||
    buckets_lock_ = nullptr;
 | 
					    buckets_lock_ = nullptr;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -122,6 +122,11 @@ void ObLSMap::reset()
 | 
				
			|||||||
    ls_buckets_ = NULL;
 | 
					    ls_buckets_ = NULL;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (OB_NOT_NULL(buckets_lock_)) {
 | 
					  if (OB_NOT_NULL(buckets_lock_)) {
 | 
				
			||||||
 | 
					    for (int64_t i = 0; i < BUCKETS_CNT; ++i) {
 | 
				
			||||||
 | 
					      if (OB_NOT_NULL(buckets_lock_ + i)) {
 | 
				
			||||||
 | 
					        (buckets_lock_ + i)->~ObQSyncLock();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ob_free(buckets_lock_);
 | 
					    ob_free(buckets_lock_);
 | 
				
			||||||
    buckets_lock_ = nullptr;
 | 
					    buckets_lock_ = nullptr;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -176,6 +181,11 @@ int ObLSMap::init(const int64_t tenant_id, ObIAllocator *ls_allocator)
 | 
				
			|||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void ObLSMap::destroy()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  reset();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ObLSMap::add_ls(
 | 
					int ObLSMap::add_ls(
 | 
				
			||||||
    ObLS &ls)
 | 
					    ObLS &ls)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -41,9 +41,10 @@ public:
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    reset();
 | 
					    reset();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  ~ObLSMap() { reset(); }
 | 
					  ~ObLSMap() { destroy(); }
 | 
				
			||||||
  void reset();
 | 
					  void reset();
 | 
				
			||||||
  int init(const int64_t tenant_id, common::ObIAllocator *ls_allocator);
 | 
					  int init(const int64_t tenant_id, common::ObIAllocator *ls_allocator);
 | 
				
			||||||
 | 
					  void destroy();
 | 
				
			||||||
  // allow_multi_true is used during replay
 | 
					  // allow_multi_true is used during replay
 | 
				
			||||||
  int add_ls(ObLS &ls);
 | 
					  int add_ls(ObLS &ls);
 | 
				
			||||||
  int del_ls(const share::ObLSID &ls_id);
 | 
					  int del_ls(const share::ObLSID &ls_id);
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user