Skip to content

Commit

Permalink
Fix a memory leak in WindowsThread
Browse files Browse the repository at this point in the history
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 #3542

Differential Revision: D7088713

Pulled By: ajkr

fbshipit-source-id: 749ecafc6a9572f587f76e516547e07734349a54
  • Loading branch information
yuslepukhin authored and facebook-github-bot committed Feb 26, 2018
1 parent dfbe52e commit 7eb292d
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion port/win/win_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ unsigned int __stdcall WindowsThread::Data::ThreadProc(void* arg) {
auto ptr = reinterpret_cast<std::shared_ptr<Data>*>(arg);
std::unique_ptr<std::shared_ptr<Data>> data(ptr);
(*data)->func_();
_endthreadex(0);
return 0;
}
} // namespace port
Expand Down

0 comments on commit 7eb292d

Please sign in to comment.