Version: Unity 7.0 Alpha (7000.0)
Language : English
Introduction to assembly load context leaks
Diagnose and fix assembly load context leaks

Assembly load context leak report reference

Each time the Editor detects a leak, it writes a full report to Logs/ALCLeaks.json in your project folder, and overwrites any previous report. Use the report to identify which object leaked and what references it.

The report contains a Leaks array with one entry per leaked object. Each entry has the following members:

Member Description
PathToRoot Chain of objects that leads from the leaked object to the object closest to the root. The first item is the leaked object itself.
Root The entity that keeps the whole chain alive.
HandleID Address of the handle that holds the leaked object. Present only when Root.Kind is Handle.
ObjectAddress Address of the object that the handle points to. Present only when Root.Kind is Handle.

Each item in PathToRoot has the following members:

Member Description
TypeName Name of the object’s type.
AssemblyName Name of the assembly that the type belongs to. Empty for types that don’t belong to a single assembly, such as arrays.
Address Address of the object at the time of the inspection.
AssemblyLoadContext Name of the context that the type belongs to. Present only when the Editor resolves the name.
Name Name of the object. Present only for objects that carry a name, such as an AssemblyLoadContext.
StackTrace Call stack of the allocation. Present only when you record allocation call stacks at level 2.

The Root member has the following members:

Member Description
Kind The kind of root that holds the chain: Handle, Stack, StaticField, Finalizer, or Other.
Flags Characteristics of the root, as a comma-separated list of Pinning, WeakRef, Interior, and Refcounted. Absent when the root has no flags.
FieldName Name of the static field that holds the chain. Present only when Kind is StaticField.
StackTrace Call stack of the handle allocation. Present only when Kind is Handle and you record allocation call stacks.

The following report describes one leaked object that a handle holds:

{
    "ALCLeaks": {
        "Leaks": [
            {
                "PathToRoot": [
                    {
                        "Address": "0x1F4A0C3D8",
                        "AssemblyName": "Assembly-CSharp-Editor",
                        "TypeName": "MyGame.AssetIndex"
                    }
                ],
                "HandleID": "0x1F3B00110",
                "ObjectAddress": "0x1F4A0C3D8",
                "Root": {
                    "Kind": "Handle"
                }
            }
        ]
    }
}

Additional resources

Introduction to assembly load context leaks
Diagnose and fix assembly load context leaks