/// <summary> /// Returns the size in bytes occupied by an ThreadLocalAddre instance. /// </summary> /// <param name="instance">instance for whch to calculate the size.</param> /// <returns>The size of the instance in bytes.</returns> public static int GetEstimatedFootprintInBytes(ThreadLocalLongAdder instance) { // ReSharper disable ArrangeRedundantParentheses SA1407 return((instance._local.Values.Count * (IntPtr.Size + ValueHolder.SizeInBytes)) + 64); // very rough estimation for thread local & values list // ReSharper restore ArrangeRedundantParentheses }
/// <summary> /// Returns the size in bytes occupied by an ThreadLocalAddre instance. /// </summary> /// <param name="instance">instance for whch to calculate the size.</param> /// <returns>The size of the instance in bytes.</returns> public static int GetEstimatedFootprintInBytes(ThreadLocalLongAdder instance) { return(instance._local.Values.Count * (IntPtr.Size + ValueHolder.SizeInBytes) + 64); // very rough estimation for thread local & values list }