Skip to content

Reduce background GC allocations #114320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
public static partial class GC
{
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void GetMemoryInfo(GCMemoryInfoData data, int kind);
private static extern unsafe void GetMemoryInfo(GCMemoryInfoData* data, int kind);

/// <summary>Gets garbage collection memory information.</summary>
/// <returns>An object that contains information about the garbage collector's memory usage.</returns>
Expand All @@ -69,7 +69,7 @@
/// <summary>Gets garbage collection memory information.</summary>
/// <param name="kind">The kind of collection for which to retrieve memory information.</param>
/// <returns>An object that contains information about the garbage collector's memory usage.</returns>
public static GCMemoryInfo GetGCMemoryInfo(GCKind kind)
public static unsafe GCMemoryInfo GetGCMemoryInfo(GCKind kind)
{
if ((kind < GCKind.Any) || (kind > GCKind.Background))
{
Expand All @@ -80,8 +80,8 @@
GCKind.Background));
}

var data = new GCMemoryInfoData();
GetMemoryInfo(data, (int)kind);
GCMemoryInfoData data = default;
GetMemoryInfo(&data, (int)kind);
return new GCMemoryInfo(data);
}

Expand Down Expand Up @@ -414,7 +414,7 @@


/// <summary>
/// Get a count of the bytes allocated over the lifetime of the process.

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build osx-x64 release Runtime_Release)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-riscv64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x86 checked CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 checked CoreCLR_ReleaseLibraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-loongarch64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug CoreCLR_Libraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-x64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 417 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L417

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(417,81): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)
/// </summary>
/// <param name="precise">If true, gather a precise number, otherwise gather a fairly count. Gathering a precise value triggers at a significant performance penalty.</param>
public static long GetTotalAllocatedBytes(bool precise = false) => precise ? GetTotalAllocatedBytesPrecise() : GetTotalAllocatedBytesApproximate();
Expand Down Expand Up @@ -599,12 +599,12 @@
return true;
}

// We need to take a snapshot of s_notifications.Count, so that in the case that

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build osx-x64 release Runtime_Release)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-riscv64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x86 checked CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 checked CoreCLR_ReleaseLibraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-loongarch64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug CoreCLR_Libraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-x64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 602 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L602

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(602,97): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)
// s_notifications[i].Notification() registers new notifications, we neither get rid

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build osx-x64 release Runtime_Release)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-riscv64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x86 checked CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 checked CoreCLR_ReleaseLibraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-loongarch64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug CoreCLR_Libraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-x64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 603 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L603

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(603,101): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)
// of them nor iterate over them.

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build osx-x64 release Runtime_Release)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-riscv64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x86 checked CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 checked CoreCLR_ReleaseLibraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-loongarch64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug CoreCLR_Libraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-x64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 604 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L604

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(604,50): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)
int count = s_notifications.Count;

// If there is no existing notifications, we won't be iterating over any and we won't

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / dotnet-linker-tests (Build osx-x64 release Runtime_Release)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-arm Debug AllSubsets_CoreCLR_ReleaseRuntimeLibs)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-riscv64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x86 checked CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 checked CoreCLR_ReleaseLibraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-loongarch64 Debug CoreCLR_TwoStage)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-arm64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-arm64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug CoreCLR_Libraries)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build android-x64 Release AllSubsets_CoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)

Check failure on line 607 in src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs

View check run for this annotation

Azure Pipelines / runtime (Build osx-x64 Debug Libraries_CheckedCoreCLR)

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs#L607

src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs(607,102): error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1028.md)
// be adding any new one. Also, there wasn't any added since we last invoked this
// method so it's safe to assume we can reset s_previousMemoryLoad.
if (count == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ public static long GetTotalAllocatedBytes(bool precise = false)
/// <summary>Gets garbage collection memory information.</summary>
/// <param name="kind">The kind of collection for which to retrieve memory information.</param>
/// <returns>An object that contains information about the garbage collector's memory usage.</returns>
public static GCMemoryInfo GetGCMemoryInfo(GCKind kind)
public static unsafe GCMemoryInfo GetGCMemoryInfo(GCKind kind)
{
if ((kind < GCKind.Any) || (kind > GCKind.Background))
{
Expand All @@ -775,8 +775,8 @@ public static GCMemoryInfo GetGCMemoryInfo(GCKind kind)
GCKind.Background));
}

var data = new GCMemoryInfoData();
RuntimeImports.RhGetMemoryInfo(ref data.GetRawData(), kind);
GCMemoryInfoData data = default;
RuntimeImports.RhGetMemoryInfo(&data, kind);
return new GCMemoryInfo(data);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ internal struct GCHeapHardLimitInfo

[MethodImpl(MethodImplOptions.InternalCall)]
[RuntimeImport(RuntimeLibrary, "RhGetMemoryInfo")]
internal static extern void RhGetMemoryInfo(ref byte info, GCKind kind);
internal static extern unsafe void RhGetMemoryInfo(GCMemoryInfoData* data, GCKind kind);

[LibraryImport(RuntimeLibrary)]
internal static unsafe partial void RhAllocateNewArray(MethodTable* pArrayEEType, uint numElements, uint flags, void* pResult);
Expand Down
36 changes: 17 additions & 19 deletions src/coreclr/vm/comutilnative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,32 +584,30 @@ FCIMPL0(INT64, GCInterface::GetTotalPauseDuration)
}
FCIMPLEND

FCIMPL2(void, GCInterface::GetMemoryInfo, Object* objUNSAFE, int kind)
FCIMPL2(void, GCInterface::GetMemoryInfo, GCMemoryInfoData* pData, int kind)
{
FCALL_CONTRACT;

FC_GC_POLL_NOT_NEEDED();

GCMEMORYINFODATAREF objGCMemoryInfo = (GCMEMORYINFODATAREF)(ObjectToOBJECTREF (objUNSAFE));

UINT64* genInfoRaw = (UINT64*)&(objGCMemoryInfo->generationInfo0);
UINT64* pauseInfoRaw = (UINT64*)&(objGCMemoryInfo->pauseDuration0);
UINT64* genInfoRaw = (UINT64*)&(pData->generationInfo0);
UINT64* pauseInfoRaw = (UINT64*)&(pData->pauseDuration0);

return GCHeapUtilities::GetGCHeap()->GetMemoryInfo(
&(objGCMemoryInfo->highMemLoadThresholdBytes),
&(objGCMemoryInfo->totalAvailableMemoryBytes),
&(objGCMemoryInfo->lastRecordedMemLoadBytes),
&(objGCMemoryInfo->lastRecordedHeapSizeBytes),
&(objGCMemoryInfo->lastRecordedFragmentationBytes),
&(objGCMemoryInfo->totalCommittedBytes),
&(objGCMemoryInfo->promotedBytes),
&(objGCMemoryInfo->pinnedObjectCount),
&(objGCMemoryInfo->finalizationPendingCount),
&(objGCMemoryInfo->index),
&(objGCMemoryInfo->generation),
&(objGCMemoryInfo->pauseTimePercent),
(bool*)&(objGCMemoryInfo->isCompaction),
(bool*)&(objGCMemoryInfo->isConcurrent),
&(pData->highMemLoadThresholdBytes),
&(pData->totalAvailableMemoryBytes),
&(pData->lastRecordedMemLoadBytes),
&(pData->lastRecordedHeapSizeBytes),
&(pData->lastRecordedFragmentationBytes),
&(pData->totalCommittedBytes),
&(pData->promotedBytes),
&(pData->pinnedObjectCount),
&(pData->finalizationPendingCount),
&(pData->index),
&(pData->generation),
&(pData->pauseTimePercent),
(bool*)&(pData->isCompaction),
(bool*)&(pData->isConcurrent),
genInfoRaw,
pauseInfoRaw,
kind);
Expand Down
12 changes: 2 additions & 10 deletions src/coreclr/vm/comutilnative.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct GCGenerationInfo
};

#include "pshpack4.h"
class GCMemoryInfoData : public Object
struct GCMemoryInfoData
{
public:
UINT64 highMemLoadThresholdBytes;
Expand Down Expand Up @@ -131,14 +131,6 @@ class GCMemoryInfoData : public Object
};
#include "poppack.h"

#ifdef USE_CHECKED_OBJECTREFS
typedef REF<GCMemoryInfoData> GCMEMORYINFODATA;
typedef REF<GCMemoryInfoData> GCMEMORYINFODATAREF;
#else // USE_CHECKED_OBJECTREFS
typedef GCMemoryInfoData * GCMEMORYINFODATA;
typedef GCMemoryInfoData * GCMEMORYINFODATAREF;
#endif // USE_CHECKED_OBJECTREFS

using EnumerateConfigurationValuesCallback = void (*)(void* context, void* name, void* publicKey, GCConfigurationType type, int64_t data);

struct GCHeapHardLimitInfo
Expand Down Expand Up @@ -166,7 +158,7 @@ class GCInterface {
static FORCEINLINE UINT64 InterlockedSub(UINT64 *pMinuend, UINT64 subtrahend);

static FCDECL0(INT64, GetTotalPauseDuration);
static FCDECL2(void, GetMemoryInfo, Object* objUNSAFE, int kind);
static FCDECL2(void, GetMemoryInfo, GCMemoryInfoData* pData, int kind);
static FCDECL0(UINT32, GetMemoryLoad);
static FCDECL0(int, GetGcLatencyMode);
static FCDECL1(int, SetGcLatencyMode, int newLatencyMode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ public bool Trim()
{
if (!log.IsEnabled())
{
foreach (KeyValuePair<SharedArrayPoolThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets)
foreach (KeyValuePair<SharedArrayPoolThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets.EnumerateOnStack())
{
Array.Clear(tlsBuckets.Key);
}
}
else
{
foreach (KeyValuePair<SharedArrayPoolThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets)
foreach (KeyValuePair<SharedArrayPoolThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets.EnumerateOnStack())
{
SharedArrayPoolThreadLocalArray[] buckets = tlsBuckets.Key;
for (int i = 0; i < buckets.Length; i++)
Expand All @@ -241,7 +241,7 @@ public bool Trim()
_ => 30_000,
};

foreach (KeyValuePair<SharedArrayPoolThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets)
foreach (KeyValuePair<SharedArrayPoolThreadLocalArray[], object?> tlsBuckets in _allTlsBuckets.EnumerateOnStack())
{
SharedArrayPoolThreadLocalArray[] buckets = tlsBuckets.Key;
for (int i = 0; i < buckets.Length; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public enum GCKind
};

[StructLayout(LayoutKind.Sequential)]
internal sealed class GCMemoryInfoData
internal struct GCMemoryInfoData
{
internal long _highMemoryLoadThresholdBytes;
internal long _totalAvailableMemoryBytes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.

IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable<KeyValuePair<TKey, TValue>>)this).GetEnumerator();

/// <summary>Provides an enumerator for the table.</summary>
private sealed class Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>
/// <summary>The core implementation for the enumerators for the table.</summary>
private struct EnumeratorCore : IDisposable
{
// The enumerator would ideally hold a reference to the Container and the end index within that
// container. However, the safety of the CWT depends on the only reference to the Container being
Expand All @@ -393,7 +393,7 @@ private sealed class Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>
private int _currentIndex; // the current index into the container
private KeyValuePair<TKey, TValue> _current; // the current entry set by MoveNext and returned from Current

public Enumerator(ConditionalWeakTable<TKey, TValue> table)
public EnumeratorCore(ConditionalWeakTable<TKey, TValue> table)
{
Debug.Assert(table != null, "Must provide a valid table");
Debug.Assert(Monitor.IsEntered(table._lock), "Must hold the _lock lock to construct the enumerator");
Expand All @@ -410,11 +410,6 @@ public Enumerator(ConditionalWeakTable<TKey, TValue> table)
_currentIndex = -1;
}

~Enumerator()
{
Dispose();
}

public void Dispose()
{
// Use an interlocked operation to ensure that only one thread can get access to
Expand Down Expand Up @@ -485,6 +480,56 @@ public KeyValuePair<TKey, TValue> Current
return _current;
}
}
}

/// <summary>Provides an enumerator for the table.</summary>
private sealed class Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>
{
private EnumeratorCore _enumeratorCore;

public Enumerator(ConditionalWeakTable<TKey, TValue> table) => _enumeratorCore = new(table);

~Enumerator()
{
Dispose();
}

public void Dispose() => _enumeratorCore.Dispose();

public bool MoveNext() => _enumeratorCore.MoveNext();

public KeyValuePair<TKey, TValue> Current => _enumeratorCore.Current;

object? IEnumerator.Current => Current;

public void Reset() { }
}

/// <summary>Gets an enumerable used to enumerate the values on the stack without allocation.</summary>
// This API is unsafe to use if the user neglects to call Dispose, which is why
// we can only use this internally where we can enforce proper foreach usage.
// It's also unsafe to use in async functions, even with proper foreach, because there's
// a chance that the async will never continue, in which case we need to rely on the finalizer in the regular enumerator.
internal RefEnumerable EnumerateOnStack() => new RefEnumerable(this);

/// <summary>Provides an enumerable used to enumerate the values on the stack without allocation.</summary>
internal readonly ref struct RefEnumerable(ConditionalWeakTable<TKey, TValue> table)
{
public RefEnumerator GetEnumerator() => new(table);
}

/// <summary>Provides an enumerator for the table that can be used on the stack without allocation.</summary>
internal ref struct RefEnumerator : IEnumerator<KeyValuePair<TKey, TValue>>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #53296 for a long discussion about why it is not the best idea to expose struct enumerator for ConditionalWeakTable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see you have mentioned in a comment - but that does not make it a good idea.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm well aware of the dangers, which is why it's internal only. I left a lengthy comment about it on the EnumerateOnStack() method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not interested in spreading more unsafe or otherwise dangerous code throughout the libraries. We believe we have too much of it and we are actively working on reducing it.

{
private EnumeratorCore _enumeratorCore;

public RefEnumerator(ConditionalWeakTable<TKey, TValue> table) => _enumeratorCore = new(table);

public void Dispose() => _enumeratorCore.Dispose();

public bool MoveNext() => _enumeratorCore.MoveNext();

public KeyValuePair<TKey, TValue> Current => _enumeratorCore.Current;

object? IEnumerator.Current => Current;

Expand Down
2 changes: 1 addition & 1 deletion src/mono/System.Private.CoreLib/src/System/GC.Mono.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private static extern void _GetGCMemoryInfo(out long highMemoryLoadThresholdByte

public static GCMemoryInfo GetGCMemoryInfo()
{
var data = new GCMemoryInfoData();
GCMemoryInfoData data = default;

_GetGCMemoryInfo(out data._highMemoryLoadThresholdBytes,
out data._memoryLoadBytes,
Expand Down
Loading