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
We have two sets of data here: Device data and Runtime data.
Add for builds targeting .NET Core 3.0+ (once #623 get merged which adds this TFM) this information to the protocol:
Runtime will take FragmentedBytesHeapSizeBytesMemoryLoadBytes
For .NET 5.0 builds there is more information available.
We need to figure out what should be sent out of the box on all events and could be an opt-in.
Sentry's front end can format bytes in a human readable form such as 1 KB, 1 GB.
This needs to be done also in the front end to make sure this readable is usable in Sentry.
Sample code that polls the API on each key hit. Eventually the SDK captures a OutOfMemoryException.
using System;using System.Collections.Generic;using Sentry;staticclassProgram{staticvoidMain(){using(SentrySdk.Init(o =>{ o.Dsn ="https://80aed643f81249d4bed3e30687b310ab@o447951.ingest.sentry.io/5428537"; o.Debug =true;})){varsize=1;varstrings=newList<string>();while(true){size *= 10;// Assumes the assembly targets .NET Core 3.0 (serves 3.0 and 3.1) and .NET 5
#ifNETCOREAPP3_0||NET5_0varinfo= GC.GetGCMemoryInfo();
Console.WriteLine($"FragmentedBytes {info.FragmentedBytes}");
Console.WriteLine($"HeapSizeBytes {info.HeapSizeBytes}");
Console.WriteLine($"MemoryLoadBytes {info.MemoryLoadBytes}");
Console.WriteLine($"TotalAvailableMemoryBytes {info.TotalAvailableMemoryBytes}");
Console.WriteLine($"HighMemoryLoadThresholdBytes {info.HighMemoryLoadThresholdBytes}");
#endif
// API only available on .NET 5
#if NET5_0
Console.WriteLine($"Compacted {info.Compacted}");
Console.WriteLine($"Concurrent {info.Concurrent}");
Console.WriteLine($"Generation {info.Generation}");
Console.WriteLine($"Index {info.Index}");for(vari=0;i< info.GenerationInfo.Length;i++){vargenInfo= info.GenerationInfo[i];
Console.WriteLine($"\tFragmentationAfterBytes[{i}]: {genInfo.FragmentationAfterBytes}");
Console.WriteLine($"\tFragmentationBeforeBytes[{i}]: {genInfo.FragmentationBeforeBytes}");
Console.WriteLine($"\tSizeAfterBytes[{i}]: {genInfo.SizeAfterBytes}");
Console.WriteLine($"\tSizeBeforeBytes[{i}]: {genInfo.SizeBeforeBytes}");}foreach(var pauseDuration in info.PauseDurations){
Console.WriteLine($"\tPauseDurations {pauseDuration}");}
Console.WriteLine($"PromotedBytes {info.PromotedBytes}");
Console.WriteLine($"FinalizationPendingCount {info.FinalizationPendingCount}");
Console.WriteLine($"TotalCommittedBytes {info.TotalCommittedBytes}");
Console.WriteLine($"PinnedObjectsCount {info.PinnedObjectsCount}");
Console.WriteLine($"PauseTimePercentage {info.PauseTimePercentage}");
#endif
strings.Add(newstring('a', size));
Console.ReadKey();}}}}
The text was updated successfully, but these errors were encountered:
.NET Core 3.0 added:
GetGCMemoryInfo
.There's a post from Maoni on this topic.
GCMemoryInfo
includes the following: informationFor example the output on a simple app that didn't allocate much yet:
We have two sets of data here: Device data and Runtime data.
Add for builds targeting .NET Core 3.0+ (once #623 get merged which adds this TFM) this information to the protocol:
Runtime
will takeFragmentedBytes
HeapSizeBytes
MemoryLoadBytes
For .NET 5.0 builds there is more information available.
We need to figure out what should be sent out of the box on all events and could be an opt-in.
Sentry's front end can format bytes in a human readable form such as 1 KB, 1 GB.
This needs to be done also in the front end to make sure this readable is usable in Sentry.
Sample code that polls the API on each key hit. Eventually the SDK captures a
OutOfMemoryException
.The text was updated successfully, but these errors were encountered: