Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Features

- Rename MemoryInfo.AllocatedBytes to MemoryInfo.TotalAllocatedBytes ([#4243](https://github.com/getsentry/sentry-dotnet/pull/4243))

## 5.9.0

### Features
Expand Down
6 changes: 3 additions & 3 deletions src/Sentry/Internal/MainSentryEventProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ private static void AddMemoryInfo(SentryContexts contexts)
{
#if NETCOREAPP3_0_OR_GREATER
var memory = GC.GetGCMemoryInfo();
var allocatedBytes = GC.GetTotalAllocatedBytes();
var totalAllocatedBytes = GC.GetTotalAllocatedBytes();
#if NET5_0_OR_GREATER
contexts[MemoryInfoKey] = new MemoryInfo(
allocatedBytes,
totalAllocatedBytes,
memory.FragmentedBytes,
memory.HeapSizeBytes,
memory.HighMemoryLoadThresholdBytes,
Expand All @@ -183,7 +183,7 @@ private static void AddMemoryInfo(SentryContexts contexts)
memory.PauseDurations.ToArray());
#else
contexts[MemoryInfoKey] = new MemoryInfo(
allocatedBytes,
totalAllocatedBytes,
memory.FragmentedBytes,
memory.HeapSizeBytes,
memory.HighMemoryLoadThresholdBytes,
Expand Down
12 changes: 6 additions & 6 deletions src/Sentry/Internal/MemoryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Sentry.Internal;

internal sealed class MemoryInfo : ISentryJsonSerializable
{
public long AllocatedBytes { get; }
public long TotalAllocatedBytes { get; }
public long FragmentedBytes { get; }
public long HeapSizeBytes { get; }
public long HighMemoryLoadThresholdBytes { get; }
Expand All @@ -26,7 +26,7 @@ internal sealed class MemoryInfo : ISentryJsonSerializable
public bool Concurrent { get; }

public MemoryInfo(
long allocatedBytes,
long totalAllocatedBytes,
long fragmentedBytes,
long heapSizeBytes,
long highMemoryLoadThresholdBytes,
Expand All @@ -42,7 +42,7 @@ public MemoryInfo(
bool concurrent,
TimeSpan[] pauseDurations)
{
AllocatedBytes = allocatedBytes;
TotalAllocatedBytes = totalAllocatedBytes;
FragmentedBytes = fragmentedBytes;
HeapSizeBytes = heapSizeBytes;
HighMemoryLoadThresholdBytes = highMemoryLoadThresholdBytes;
Expand All @@ -60,14 +60,14 @@ public MemoryInfo(
}
#else
public MemoryInfo(
long allocatedBytes,
long totalAllocatedBytes,
long fragmentedBytes,
long heapSizeBytes,
long highMemoryLoadThresholdBytes,
long totalAvailableMemoryBytes,
long memoryLoadBytes)
{
AllocatedBytes = allocatedBytes;
TotalAllocatedBytes = totalAllocatedBytes;
FragmentedBytes = fragmentedBytes;
HeapSizeBytes = heapSizeBytes;
HighMemoryLoadThresholdBytes = highMemoryLoadThresholdBytes;
Expand All @@ -80,7 +80,7 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger)
//WriteNumberIfNotZero since on OS that dont implement all props, those props are stubbed out to zero
writer.WriteStartObject();

writer.WriteNumberIfNotZero("allocated_bytes", AllocatedBytes);
writer.WriteNumberIfNotZero("total_allocated_bytes", TotalAllocatedBytes);
writer.WriteNumberIfNotZero("fragmented_bytes", FragmentedBytes);
writer.WriteNumberIfNotZero("heap_size_bytes", HeapSizeBytes);
writer.WriteNumberIfNotZero("high_memory_load_threshold_bytes", HighMemoryLoadThresholdBytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public void EnsureMemoryInfoExists()

_ = sut.Process(evt);
var memory = (MemoryInfo)evt.Contexts[MainSentryEventProcessor.MemoryInfoKey];
Assert.NotEqual(0, memory.TotalAvailableMemoryBytes);
Assert.NotEqual(0, memory.HighMemoryLoadThresholdBytes);
Assert.NotEqual(0, memory.TotalAvailableMemoryBytes);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
allocated_bytes: 1,
total_allocated_bytes: 1,
fragmented_bytes: 2,
heap_size_bytes: 3,
high_memory_load_threshold_bytes: 4,
Expand Down
Loading