Skip to content

Commit c5965ab

Browse files
authored
Rename MemoryInfo.AllocatedBytes to MemoryInfo.TotalAllocatedBytes (#4243)
1 parent 0e11682 commit c5965ab

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
7+
- Rename MemoryInfo.AllocatedBytes to MemoryInfo.TotalAllocatedBytes ([#4243](https://github.com/getsentry/sentry-dotnet/pull/4243))
8+
39
## 5.9.0
410

511
### Features

src/Sentry/Internal/MainSentryEventProcessor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ private static void AddMemoryInfo(SentryContexts contexts)
163163
{
164164
#if NETCOREAPP3_0_OR_GREATER
165165
var memory = GC.GetGCMemoryInfo();
166-
var allocatedBytes = GC.GetTotalAllocatedBytes();
166+
var totalAllocatedBytes = GC.GetTotalAllocatedBytes();
167167
#if NET5_0_OR_GREATER
168168
contexts[MemoryInfoKey] = new MemoryInfo(
169-
allocatedBytes,
169+
totalAllocatedBytes,
170170
memory.FragmentedBytes,
171171
memory.HeapSizeBytes,
172172
memory.HighMemoryLoadThresholdBytes,
@@ -183,7 +183,7 @@ private static void AddMemoryInfo(SentryContexts contexts)
183183
memory.PauseDurations.ToArray());
184184
#else
185185
contexts[MemoryInfoKey] = new MemoryInfo(
186-
allocatedBytes,
186+
totalAllocatedBytes,
187187
memory.FragmentedBytes,
188188
memory.HeapSizeBytes,
189189
memory.HighMemoryLoadThresholdBytes,

src/Sentry/Internal/MemoryInfo.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Sentry.Internal;
77

88
internal sealed class MemoryInfo : ISentryJsonSerializable
99
{
10-
public long AllocatedBytes { get; }
10+
public long TotalAllocatedBytes { get; }
1111
public long FragmentedBytes { get; }
1212
public long HeapSizeBytes { get; }
1313
public long HighMemoryLoadThresholdBytes { get; }
@@ -26,7 +26,7 @@ internal sealed class MemoryInfo : ISentryJsonSerializable
2626
public bool Concurrent { get; }
2727

2828
public MemoryInfo(
29-
long allocatedBytes,
29+
long totalAllocatedBytes,
3030
long fragmentedBytes,
3131
long heapSizeBytes,
3232
long highMemoryLoadThresholdBytes,
@@ -42,7 +42,7 @@ public MemoryInfo(
4242
bool concurrent,
4343
TimeSpan[] pauseDurations)
4444
{
45-
AllocatedBytes = allocatedBytes;
45+
TotalAllocatedBytes = totalAllocatedBytes;
4646
FragmentedBytes = fragmentedBytes;
4747
HeapSizeBytes = heapSizeBytes;
4848
HighMemoryLoadThresholdBytes = highMemoryLoadThresholdBytes;
@@ -60,14 +60,14 @@ public MemoryInfo(
6060
}
6161
#else
6262
public MemoryInfo(
63-
long allocatedBytes,
63+
long totalAllocatedBytes,
6464
long fragmentedBytes,
6565
long heapSizeBytes,
6666
long highMemoryLoadThresholdBytes,
6767
long totalAvailableMemoryBytes,
6868
long memoryLoadBytes)
6969
{
70-
AllocatedBytes = allocatedBytes;
70+
TotalAllocatedBytes = totalAllocatedBytes;
7171
FragmentedBytes = fragmentedBytes;
7272
HeapSizeBytes = heapSizeBytes;
7373
HighMemoryLoadThresholdBytes = highMemoryLoadThresholdBytes;
@@ -80,7 +80,7 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
8080
//WriteNumberIfNotZero since on OS that dont implement all props, those props are stubbed out to zero
8181
writer.WriteStartObject();
8282

83-
writer.WriteNumberIfNotZero("allocated_bytes", AllocatedBytes);
83+
writer.WriteNumberIfNotZero("total_allocated_bytes", TotalAllocatedBytes);
8484
writer.WriteNumberIfNotZero("fragmented_bytes", FragmentedBytes);
8585
writer.WriteNumberIfNotZero("heap_size_bytes", HeapSizeBytes);
8686
writer.WriteNumberIfNotZero("high_memory_load_threshold_bytes", HighMemoryLoadThresholdBytes);

test/Sentry.Tests/Internals/MainSentryEventProcessorTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public void EnsureMemoryInfoExists()
6262

6363
_ = sut.Process(evt);
6464
var memory = (MemoryInfo)evt.Contexts[MainSentryEventProcessor.MemoryInfoKey];
65-
Assert.NotEqual(0, memory.TotalAvailableMemoryBytes);
6665
Assert.NotEqual(0, memory.HighMemoryLoadThresholdBytes);
6766
Assert.NotEqual(0, memory.TotalAvailableMemoryBytes);
6867
}

test/Sentry.Tests/Internals/MemoryInfoTests.WriteTo.DotNet8_0.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
allocated_bytes: 1,
2+
total_allocated_bytes: 1,
33
fragmented_bytes: 2,
44
heap_size_bytes: 3,
55
high_memory_load_threshold_bytes: 4,

test/Sentry.Tests/Internals/MemoryInfoTests.WriteTo.DotNet9_0.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
allocated_bytes: 1,
2+
total_allocated_bytes: 1,
33
fragmented_bytes: 2,
44
heap_size_bytes: 3,
55
high_memory_load_threshold_bytes: 4,

0 commit comments

Comments
 (0)