microsoft / microsoft/CLRInstrumentationEngine

Memory leaks on process shutdown

Open
#319 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug task
Dominant language
C++
Stars
102
Forks
52
Avg merge
13h 11m
Merged PRs (30d)
6

Description

Our ref counting is indicating memory leaks on process shut down.

It looks like this is probably due to a circular reference between App Domains and the Module Infos contained therein. That circular reference is meant to be broken when we get a module unload callback, but that callback is not guaranteed on process shut down. We will likely also leak App Domain references on shut down because I don't think we are guaranteed to get a callback for that either. Essentially, I think all bets are off on callbacks during process exit.

We might need to have better memory leak detection. It probably wouldn't hurt to be a little better about circular references anyway. For example, there is no need to hold a ref-counted reference to the App Domain from the Module Info, since the App Domain should keep it alive.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the App Domain and Module Info reference relationships and the module-unload and process-shutdown callback paths described in the issue. Done means shutdown no longer reports the identified leaks, circular references are handled safely, and leak detection covers exit paths where callbacks are absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.