Interprocess synchronization has always been classified as a "slow" operation, but that is largely only because the Windows implementation requires switching to kernel mode (an expensive operation) each time you attempt to acquire a mutex.

The mtrace() function logs all memory leaks. Next, the memory allocations and deallocations are logged to a text file pointed to by the environment variable MALLOC_TRACE. Finally, a Perl utility called mtrace parses the text file logged by your program and identifies the memory leaks.