My system is Ubuntu 11.04 and the library is tbb 4.1.
I found a heisenbug (crash sometimes) occured when the application exited. After I narrowed down the issue, the root cause was the combination of thread local storage and TBB library. I had prepared an easy setup for this issue: https://github.com/DemonGiggle/TlsWithTBB
Since it was not easy to crash, I suggested to use valgrind to grasp the error.
I summaried the root cause here:
When a thread touched a TLS variable, it firstly call __tls_get_addr() to obtain the address for this specific thread, which in turn called mmap(). And when a thread was exiting, it deallocated its TLS data, which in turn called free(), hooked by tbb library. The function free() in TBB was not aware whether the input pointer was allocated by TBB, and it crashed when it tried to access what it expected data structure from customized malloc.