This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
leak from main thread
I know that this is not the intended usage of the pthread library (as it
uses pthread for the main thread),
but the following program leaks two blocks of memory (with
pthreads-snap-2002-03-02):
#include <crtdbg.h>
#include <pthread.h>
int main()
{
// turn on leak detection
int dbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
dbgFlag |= _CRTDBG_LEAK_CHECK_DF;
_CrtSetDbgFlag(dbgFlag);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
return 0;
}
Supposedly, the setcancelstate creates a mutex that is never freed (the
equivalent mutex is freed though
when a posix thread exits).
--
Axel Mamode