diff --git a/tcmalloc/span.h b/tcmalloc/span.h index a7a90998f..b90a9c33c 100644 --- a/tcmalloc/span.h +++ b/tcmalloc/span.h @@ -304,7 +304,18 @@ class ABSL_CACHELINE_ALIGNED Span final : public SpanList::Elem { uint16_t embed_count_; uint16_t freelist_; }; - std::atomic allocated_; // Number of non-free objects +#ifdef TCMALLOC_INTERNAL_LEGACY_LOCKING + std::atomic +#else + struct { + uint16_t value; + + uint16_t load(std::memory_order) const { return value; } + + void store(uint16_t v, std::memory_order) { value = v; } + } +#endif + allocated_; // Number of non-free objects #ifndef TCMALLOC_INTERNAL_LEGACY_LOCKING uint8_t cache_size_; #else