Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poco::Thread leak on Linux #79

Closed
aleks-f opened this issue Feb 7, 2013 · 0 comments
Closed

Poco::Thread leak on Linux #79

aleks-f opened this issue Feb 7, 2013 · 0 comments
Assignees
Labels
Milestone

Comments

@aleks-f
Copy link
Member

aleks-f commented Feb 7, 2013

http://pocoproject.org/forum/viewtopic.php?f=12&t=5760

by rd » Thu Feb 07, 2013 5:43 am

Hi,

It seems to me there is a problem when using a Poco::Thread on linux when you do not call join() on it and the thread function simply finishes before the Thread object destructor is called.

The destructor only calls pthread_detach() if isRunningImpl() is true, but if the ThreadImpl::runnableEntry(void* pThread) function finishes, it will set pData->pRunnableTarget = 0, so isRunningImpl() will return false then.

This causes the virtual memory usage of the process to increase with every thread, an after a few hundred started&stopped threads you will get "cannot start thread" exceptions.

Thread_POSIX.cpp:

ThreadImpl::~ThreadImpl()
{
   if (isRunningImpl())
      pthread_detach(_pData->thread);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant