You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ThreadsafeCounterDictionary allocates a CounterItem on every recorded drop #5686
Branch:main. No public API change, so this doesn't need to wait for v7.
ThreadsafeCounterDictionary.Add and Increment call _items.GetOrAdd(key, new CounterItem()) (ThreadsafeCounterDictionary.cs:27,33). That allocates a CounterItem on every call, even when the key already exists. #5607 adds call sites on hot paths, such as every dropped log or metric.
Measured: a dropped log went from 0 B to 24 B allocated. The factory overload, GetOrAdd(key, static _ => new CounterItem()), brings it back to 0 B. CollectionsExtensions.cs:10 already uses the factory overload.
Activity
linear-code commentedon Oct 7, 2026
NET-847
perf: counting discarded telemetry for client reports no longer alloc…