Cleanup of ThreadStatusUtil structures should use the DB's reference
Summary: instead of thread_local The cleanup path for the rocksdb database might not have the thread_updater_local_cache_ pointer initialized because the thread executing the cleanup is likely not a rocksdb thread. This results in a memory leak detected by Valgrind. The cleanup code path should use the thread_status_updater pointer obtained from the DB object instead of a thread local one. Closes https://github.com/facebook/rocksdb/pull/2059 Differential Revision: D4801611 Pulled By: hermanlee fbshipit-source-id: 407d7de
This commit is contained in:
parent
4fb65f9ea7
commit
c0be8be0cf
@ -144,10 +144,11 @@ void ThreadStatusUtil::EraseColumnFamilyInfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThreadStatusUtil::EraseDatabaseInfo(const DB* db) {
|
void ThreadStatusUtil::EraseDatabaseInfo(const DB* db) {
|
||||||
if (thread_updater_local_cache_ == nullptr) {
|
ThreadStatusUpdater* thread_updater = db->GetEnv()->GetThreadStatusUpdater();
|
||||||
|
if (thread_updater == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
thread_updater_local_cache_->EraseDatabaseInfo(db);
|
thread_updater->EraseDatabaseInfo(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThreadStatusUtil::MaybeInitThreadLocalUpdater(const Env* env) {
|
bool ThreadStatusUtil::MaybeInitThreadLocalUpdater(const Env* env) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user