Detects when threads aren’t closed after use.
- Xcode 8.0+
This check detects threads created with the pthread_create(_:_:_:_:) function without a corresponding call to the pthread_join(_:_:) function. Leaked threads can result in decreased performance and crashing of your program.
Leaked Thread in C
In the following example, the
thread variable is created but not closed after use.
Add a call to the pthread_join(_:_:) function.
Alternatively, you can create a detached thread by passing the PTHREAD_CREATE_DETACHED attribute to pthread_create(_:_:_:_:), or calling pthread_detach(_:) on the thread after creation.