MandalaConsulting.Memory 0.0.5

dotnet add package MandalaConsulting.Memory --version 0.0.5
                    
NuGet\Install-Package MandalaConsulting.Memory -Version 0.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MandalaConsulting.Memory" Version="0.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MandalaConsulting.Memory" Version="0.0.5" />
                    
Directory.Packages.props
<PackageReference Include="MandalaConsulting.Memory" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MandalaConsulting.Memory --version 0.0.5
                    
#r "nuget: MandalaConsulting.Memory, 0.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MandalaConsulting.Memory@0.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MandalaConsulting.Memory&version=0.0.5
                    
Install as a Cake Addin
#tool nuget:?package=MandalaConsulting.Memory&version=0.0.5
                    
Install as a Cake Tool

MandalaConsulting.Memory

A .NET library providing memory management utilities for optimizing application performance through controlled garbage collection.

Overview

The MandalaConsulting.Memory library offers utilities to manage and optimize memory usage in .NET applications. It provides controlled garbage collection mechanisms to help return unused memory to the operating system.

Installation

Install via NuGet:

dotnet add package MandalaConsulting.Memory

Usage

GarbageCollection Class

The GarbageCollection class provides methods to perform manual garbage collection and attempt to return unused memory to the operating system.

using MandalaConsulting.Optimization.Memory;

// Create a new instance
var gc = new GarbageCollection();

// Perform garbage collection
gc.PerformGarbageCollection(null);

Key Features

  • Manual Garbage Collection: Triggers garbage collection on demand
  • Memory Return to OS: Attempts to return unused memory back to the operating system
  • No-GC Region Management: Uses .NET's no-GC region feature to optimize memory return

How It Works

  1. Garbage Collection: Calls GC.Collect() and waits for pending finalizers
  2. Memory Assessment: Checks total memory usage
  3. No-GC Region: Attempts to create a no-GC region to facilitate memory return
  4. Memory Release: Ends the no-GC region, triggering memory return to the OS

Best Practices

  • Use sparingly - manual garbage collection can impact performance
  • Best suited for scenarios where large amounts of memory need to be released
  • Consider using after completing memory-intensive operations
  • Monitor application performance when implementing manual GC

Requirements

  • .NET Standard 2.0 or higher
  • Compatible with .NET Core 2.0+ and .NET Framework 4.6.1+

License

Copyright © 2023 Mandala Consulting, LLC. All rights reserved.

Author

Created by Alexander Fields

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MandalaConsulting.Memory:

Package Downloads
MandalaConsulting.APIMiddlewares

Middlewares for APIs - MandalaConsulting.APIMiddlewares

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.5 231 7/5/2025
0.0.4 514 6/8/2025
0.0.3 200 6/8/2025
0.0.3-develop.8 170 6/8/2025
0.0.2 585 10/15/2024
0.0.2-develop.7 167 6/8/2025
0.0.1 127 10/15/2024