I have some code that dynamically allocates a new std::thread
from the C++11 <thread>
header, like this:
std::thread *th = new thread( /* my args */);
Some time later, I call join:
th->join();
Since I dynamically allocated the thread, do I also need to call delete th;
to free the memory? If I do, do I still need to call join()
first?