.Net Core 2.0: first step to GC customization

.Net Core 2.0 have a new interesting feature: the ability to customize GC. It’s not already in standard version, we must compiled a custom CoreCLR version but it’s in source code now!

This post describes how to build a GC version doing nothing (ie with no garbage collection at all). This can be used in very specific apps and as the first step to a custom GC.

Yet another proof that .Net Core is moving in the right  direction.

Zero Garbage Collector for .NET Core – TooSlowException

“How much memory is your process using?”

This post does a great job sumarizing the different notions behind memory management in Windows. Clear and consise explanations details virtual/physical, commited/reserved and how section sharing can complexify computation of “How much memory is your process using?”.

A link that is worth preserving at least for the definition of each term: Windows Process Memory Usage Demystified | All Your Base Are Belong To Us

Minidumper: cli to generate minidump

This cli tool is able to generate minidump of living app in three mode: full, minimal and heap. heap is really interesting because:

“dumps generated by the heap mode can be 5x or 10x smaller than full memory dumps, but will still allow complete investigation of many .NET issues by tools like Visual Studio and WinDbg (SOS)”

goldshtn/minidumper: Write minidumps of .NET processes with full memory, only CLR heaps, or no memory at all

Moreover, mini dump generation is located into an external library: DumpWriter. This library can be integrated into any program to add mini dump generation capability.

Generating a minidump is technically easy. You call MiniDumpWriteDump with a MINIDUMP_TYPE parameter to choose wich memory ranges to gather  or use a CallbackParam to manually filter memory ranges. But choosing the right one is a complicated process. Other posts are related on how memory ranges are choosen to be saved in heap mode :

Extension to Razor HtmlHelper

How to export a C# enum:

public enum AssetStatusEnum


    var assetStatusEnum = {"Free":0,"Reserved":1,"Inactive":2,"UnderMaintenance":3}

In implementing an extension method:

public static class HtmlEnumExtensions
    public static MvcHtmlString EnumToString<T>(this HtmlHelper helper)
        var values = Enum.GetValues(typeof(T)).Cast<int>();
        var enumDictionary = values.ToDictionary(value => Enum.GetName(typeof(T), value));
        return new MvcHtmlString(JsonConvert.SerializeObject(enumDictionary));

and using it like this:

    var assetStatusEnum = @(Html.EnumToString())


Converting C# enums to JavaScript | Gunnar Peipman – Programming Blog