Skip to content

Memory leak at debugger-agent.c (dotnet version - 11.0.100-rc.1.26420.103) - #133594

Merged
lateralusX merged 1 commit into
dotnet:mainfrom
samitistfobos-dev:fix/memory-leak-debugger-agent-133354
Sep 11, 2026
Merged

lateralusX merged 1 commit into
dotnet:mainfrom
samitistfobos-dev:fix/memory-leak-debugger-agent-133354

Conversation

@samitistfobos-dev

Copy link
Copy Markdown
Contributor

Fix: MEMORY_LEAK

Problem:
The variables event_requests and pending_assembly_loads in src/mono/component/debugger-agent.c are each initialized twice (event_requests: line 792 and line 1623; pending_assembly_loads: line 1625 and line 810). The second assignment overwrites the pointer to the previously allocated GPtrArray, so the first allocation is leaked.

Solution:
Added guards so that the GPtrArray is created only when the corresponding variable has not been initialized yet.

Signed-off-by: [email protected]
Signed-off-by: [email protected]

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 10, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@samitistfobos-dev

Copy link
Copy Markdown
Contributor Author

Fix for #133594

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @thaystg, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

@samitistfobos-dev
samitistfobos-dev force-pushed the fix/memory-leak-debugger-agent-133354 branch 3 times, most recently from 631a354 to 0a9d4ff Compare September 11, 2026 07:52
Problem:

The variables event_requests and pending_assembly_loads in

src/mono/component/debugger-agent.c are each initialized twice

(event_requests: line 792 and line 1623; pending_assembly_loads:

line 1625 and line 810). The second assignment overwrites the

pointer to the previously allocated GPtrArray, so the first

allocation is leaked.

Solution:

Added guards so that the GPtrArray is created only when the

corresponding variable has not been initialized yet.

Signed-off-by: [email protected]

Signed-off-by: [email protected]
@samitistfobos-dev
samitistfobos-dev force-pushed the fix/memory-leak-debugger-agent-133354 branch from 0a9d4ff to 19b0c1b Compare September 11, 2026 07:52
@lateralusX

Copy link
Copy Markdown
Member

/ba-g Windows x64 Mono minijit failures reproduce on main build 1592254 with the same 46 work items crashing with 0xC0000409 FAST_FAIL_SET_CONTEXT_DENIED; unrelated to this debugger-agent allocation change.

@lateralusX lateralusX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lateralusX
lateralusX merged commit 7bde5e2 into dotnet:main Sep 11, 2026
72 of 74 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 14, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Debugger-mono community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants