Memory & GC
var baseline = new Snapshot(80, 40, 16);
var current = new Snapshot(140, 42, 16);
Console.WriteLine($"process-delta-MiB:{current.Process - baseline.Process}");
Console.WriteLine($"managed-live-delta-MiB:{current.Live - baseline.Live}");
Console.WriteLine("next:inspect-native-and-other-process-memory;confirm-matching-time-window");
Console.WriteLine("values:synthetic-incident-fixture");
record Snapshot(int Process, int Live, int Fragmented);
Reveal answer and reasoning
The portable program compares two deliberately synthetic snapshots. Process memory rises from eighty to one hundred forty MiB, a delta of sixty. Managed live memory rises from forty to forty-two MiB, a delta of two. The fragmented value is unchanged in this fixture. The output suggests inspecting native and other process memory while confirming a matching observation window.
That suggestion is a next investigation step, not a definitive diagnosis from three numbers. The fixture does not subtract managed live bytes from working set and claim the remainder is exactly native allocations. Shared pages, GC committed space, sampling differences and other categories complicate that accounting. Its final line explicitly labels the inputs as synthetic so they cannot be mistaken for measurements of the user's device or this application's current health.
The SDK lab retains eight large arrays, requests a bounded educational collection and prints a JSON record containing timestamp, runtime, PID, working set, GC index, heap size, fragmentation, committed bytes and cumulative allocation. The arrays remain deliberately live through the observation. Exact numbers are not asserted, and the explanation distinguishes process-resident memory from last-collection GC fields.
For a real incident, collect evidence at comparable lifecycle points before and after a controlled workload. If the target is containerized, include quota and neighboring process activity where relevant. Diagnostic artifacts can contain application data, so use the project's approved storage and access practices. A dump from the wrong replica or after a restart can be technically valid yet answer the wrong incident question.
What a strong answer covers
- A managed heap snapshot is not a complete process-memory account.
- Allocation rate, last-GC snapshots and RSS need aligned observation windows.
- A retaining path proves ownership; a large type count alone does not prove a leak.
Common pitfall
Subtracting an unaligned managed snapshot from working set and labeling the remainder an exact native-memory total.
Follow-up questions
- How do you prove two snapshots came from the same replica and workload phase?
- Which result would falsify your proposed retention fix?
Self-review
Choose what to revisit. These marks are your own assessment and are separate from lesson completion.