dotnet / dotnet/diagnostics

SOS's !FinalizeQueue should filter out WeakReferences

Open
#5,742 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
1.3k
Forks
404
Avg merge
2d 3h
Merged PRs (30d)
38

Description

We were recently looking at a dump where it appeared there was a very large number of objects in the finalizer queue according to the !FinalizeQueue command. Upon further investigation this appeared to be a red herring, since the vast majority of objects are WeakReferences, and [those are magic](https://github.com/dotnet/runtime/blob/7356734a70e52816c9768009bafb4ff24e32b7d4/src/libraries/System.Private.CoreLib/src/System/WeakReference.T.cs#L169-L177). Basically, they appear as finalizable objects, but they won't be finalized by the queue, but rather cleaned up by the GC.

I'd propose that !FinalizeQueue should just filter out the WeakReferences, since that's effectively what the runtime is doing as well. Otherwise this can result in some confusion of the actual state of your process.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.