Creating lots of Web workers on Mac platforms leaks lots of Mach ports. Eventually, the process can exhaust its allocation of Mach ports from the kernel, which can then cause all sorts of badness, including the inability to allocate new virtual memory from the kernel. ThreadingPthreads.cpp and ThreadIdentifierDataPthreads.cpp need to be refactored so that we do not leak these kernel resources. I would assume that we also leak kernel resources on other pthreads platforms as well.
Created attachment 159772 [details]
Comment on attachment 159772 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=159772&action=review
r=me with some style comments.
> +static pthread_t unsafePthreadHandleForIdentifier(ThreadIdentifier id)
How about calling this "pthreadHandleForIdentifierWithLockAlreadyHeld".
> +void threadWasJoined(ThreadIdentifier threadID)
Let's just move this code into waitForThreadCompletion.
> +void unsafeThreadWasDetached(ThreadIdentifier threadID)
Let's inline this, since I don't like the "unsafe" prefix and inlining will solve that and avoid anyone calling this without the lock.
> + delete state;
Let's use OwnPtr in the map instead.
Committed r126208: <http://trac.webkit.org/changeset/126208>