Details:
Provide thread-safe StringSaver and bAlloc by assigning each thread its own StringSaver and allocator. Usage: code that might be run in different threads should call the new perThreadSaver() or makePerThread() instead of the current util (saver() and make()) User can enable this unconditionally at compile time by setting -DTHREAD_SAFE_MEMORY
Some considerations:
- This might have some perf/memroy impact.
- TLS support might not be available on all archs. (Darwin?)
Benchmarks done on linking envoy and chromium for darwins showed no perf different when using the new allocators
It is best if we had llvm::sys::ScopedWriter lock(contextMutex); here too.