Investigating retained memory
medium 6 minA memory leak in a managed service can consist entirely of reachable objects that are no longer useful.
Where it shows up
The same pattern appears across everyday software.
A cache that never releases old tenants
A worker caches data per tenant and never evicts inactive entries. Capture two bounded heap summaries under similar load and group by retained size and owner. A rising post-collection floor with a growing key count supports the cache hypothesis. Use expiry or a size bound consistent with correctness and test churn over several collection cycles.
Verifying the intervention
Bound cache ownership and verify the post-collection floor across repeated churn. If the live set stays flat, investigate native buffers, allocator retention, mapped files and file cache before calling it a managed-heap leak.