Home > Software engineering >  Use MFC engineering pthread Win32 version has a memory leak
Use MFC engineering pthread Win32 version has a memory leak

Time:09-27

In the MFC and the win32 application engineering only do the simple test has the same problem, the console project no problem, is associated with a UI thread
The static void * Run (void * param)
{
return 0;
}
Pthread_create (& amp; Nullptr m_id, & amp; Run, this);
Void * value_ptr;
Pthread_join (m_id, & amp; Value_ptr);

To create the release,

Detected the memory leaks!
Dumping objects - & gt;
{399} normal block at 0 x00adc7d8, 160 bytes long.
Data: & lt;> 02 00 00 00 00 00 00 00 00 00 F0 02 D8 C7 AD 00
{378} normal block at 0 x00adb678, 160 bytes long.
Data: & lt; X & gt; 00 00 00 00 00 00 00 00 00 00 00 00 00 78 B6 AD
{59} normal block at 0 x00ad34a8, 16 bytes long.
Data: & lt;> 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{58} normal block at 0 x00ad3458, 16 bytes long.
Data: & lt;> 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
The Object dump complete.

CodePudding user response:

Multiple Threads in the User Interface of http://msdn.microsoft.com/zh-cn/library/ms810439.aspx

CodePudding user response:

Pthread_create multithreaded Unix operating system was created function, MFC?

CodePudding user response:

Void * value_ptr;
Pthread_join (m_id, & amp; Value_ptr);
Instead of directly
Pthread_join (m_id, NULL);

CodePudding user response:

refer to the second floor schlafenhamster response:
pthread_create multithreaded Unix operating system was created function, MFC?


PThread for window system version,

CodePudding user response:

UP UP

CodePudding user response:

No one in the MFC project using POSIX Threads for Win32

CodePudding user response:

Directly in c + + 11 STD: : thread, cross-platform, and with the third party to do,
  • Related