MemoryAnalyzers 0.1.0-beta.5
dotnet add package MemoryAnalyzers --version 0.1.0-beta.5
NuGet\Install-Package MemoryAnalyzers -Version 0.1.0-beta.5
<PackageReference Include="MemoryAnalyzers" Version="0.1.0-beta.5"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add MemoryAnalyzers --version 0.1.0-beta.5
#r "nuget: MemoryAnalyzers, 0.1.0-beta.5"
// Install MemoryAnalyzers as a Cake Addin #addin nuget:?package=MemoryAnalyzers&version=0.1.0-beta.5&prerelease // Install MemoryAnalyzers as a Cake Tool #tool nuget:?package=MemoryAnalyzers&version=0.1.0-beta.5&prerelease
memory-analyzers
A set of Roslyn C# code analyzers for finding memory leaks in iOS and MacCatalyst applications -- with potentially other ideas in the future.
For more information on the "circular reference" problem on Apple platforms, see:
Note that this "circular reference" situation would occur in Swift or Objective-C, so it is not a .NET-specific problem. It does not occur on Android or Windows platforms.
MA0001
Don't define public
events in NSObject
subclasses:
public class MyView : UIView
{
// NOPE!
public event EventHandler MyEvent;
}
MA0002
Don't declare members in NSObject
subclasses unless they are:
WeakReference
orWeakReference<T>
- Value types
class MyView : UIView
{
// NOPE!
public UIView? Parent { get; set; }
public void Add(MyView subview)
{
subview.Parent = this;
AddSubview(subview);
}
}
MA0003
Don't subscribe to events inside NSObject
subclasses unless:
- It's your event via
this.MyEvent
or from a base type. - The method is
static
.
class MyView : UIView
{
public MyView()
{
var picker = new UIDatePicker();
AddSubview(picker);
picker.ValueChanged += OnValueChanged;
}
void OnValueChanged(object sender, EventArgs e) { }
// Use this instead and it doesn't leak!
//static void OnValueChanged(object sender, EventArgs e) { }
}
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MemoryAnalyzers:
Package | Downloads |
---|---|
Dhgms.QualityAssurancePack
Collection of packages for assisting in QA during .NET software development |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on MemoryAnalyzers:
Repository | Stars |
---|---|
dotnet/maui
.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
|
|
Redth/Maui.VirtualListView
A slim ListView implementation for .NET MAUI that uses Platform virtualized lists / collections
|
Version | Downloads | Last updated |
---|---|---|
0.1.0-beta.5 | 15,794 | 10/30/2023 |
0.1.0-beta.4 | 284 | 10/24/2023 |
0.1.0-beta.3 | 4,271 | 8/10/2023 |
0.1.0-beta.2 | 95 | 8/7/2023 |
0.1.0-beta.1 | 110 | 7/25/2023 |