Workaround TSan warning about data race in generic_malloc_many
authorIvan Maidanski <ivmai@mail.ru>
Fri, 1 Dec 2017 08:48:08 +0000 (11:48 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 1 Dec 2017 08:48:08 +0000 (11:48 +0300)
commit31cc9697e40ad05bf92b9570211ad4dd902fc0cc
tree0f0cb48337fe417f45e78903ca09d19641e8bd88
parent1dc2066460912e132e5aaf48eac30f6261ed23d9
Workaround TSan warning about data race in generic_malloc_many

It is acceptable to update GC_bytes_found counter without
synchronization (so, it is OK to have inaccurate value in
GC_bytes_found in favor of performance).

* mallocx.c [PARALLEL_MARK && THREAD_SANITIZER]
(GC_generic_malloc_many): Acquire the allocation lock to update
GC_bytes_found (after successful GC_reclaim_generic).
* mallocx.c [PARALLEL_MARK && !THREAD_SANITIZER]
(GC_generic_malloc_many): Move GC_bytes_found update into the block
executed with the mark lock held.
mallocx.c