Skip to content

Poco::Thread leak on Linux #79

@aleks-f

Description

@aleks-f

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);
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions