From 7eb292da144f319638ade09127e58eaec286f93a Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 26 Feb 2018 13:44:25 -0800 Subject: [PATCH] Fix a memory leak in WindowsThread Summary: _endthreadex does not return and thus objects for stack destructors do not run. This creates a memory leak. We remove the calls since _enthreadex called automatically after the threadproc returns i.e. thread exits. Closes https://github.com/facebook/rocksdb/pull/3542 Differential Revision: D7088713 Pulled By: ajkr fbshipit-source-id: 749ecafc6a9572f587f76e516547e07734349a54 --- port/win/win_thread.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/port/win/win_thread.cc b/port/win/win_thread.cc index 7493320326..8c1d68a7b3 100644 --- a/port/win/win_thread.cc +++ b/port/win/win_thread.cc @@ -166,7 +166,6 @@ unsigned int __stdcall WindowsThread::Data::ThreadProc(void* arg) { auto ptr = reinterpret_cast*>(arg); std::unique_ptr> data(ptr); (*data)->func_(); - _endthreadex(0); return 0; } } // namespace port