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
main
Dmitri Smirnov 7 years ago committed by Facebook Github Bot
parent dfbe52e099
commit 7eb292da14
  1. 1
      port/win/win_thread.cc

@ -166,7 +166,6 @@ unsigned int __stdcall WindowsThread::Data::ThreadProc(void* arg) {
auto ptr = reinterpret_cast<std::shared_ptr<Data>*>(arg); auto ptr = reinterpret_cast<std::shared_ptr<Data>*>(arg);
std::unique_ptr<std::shared_ptr<Data>> data(ptr); std::unique_ptr<std::shared_ptr<Data>> data(ptr);
(*data)->func_(); (*data)->func_();
_endthreadex(0);
return 0; return 0;
} }
} // namespace port } // namespace port

Loading…
Cancel
Save