Skip to content

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

Closed

Description

@samitistfobos-dev

Potential problem

In /src/runtime/src/mono/mono/component/debugger-agent.c the variable event_requests is initialized twice. The first initialization is performed at line 792 via a call to g_ptr_array_new, and the second one is performed at line 808 inside the function mono_init_debugger_agent_common (line 1623). As a result, the memory allocated after the first initialization is lost, because the pointer to it is overwritten by the second assignment.

A similar issue exists with the variable pending_assembly_loads — it is first initialized at line 808 inside the function mono_init_debugger_agent_common (line 1625), and then re-initialized at line 810 via a call to g_ptr_array_new, which again leaks the previously allocated memory.

Possible solution

It is suggested to add checks in the relevant places (at lines 1623 and 810) to ensure that the variable has not been initialized yet before performing the assignment. It is also acceptable to add such checks in every place where the variables are initialized (lines 792, 810, 1623, and 1625).

Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.

Author A. Burlakov.

Activity

  1. akoeplinger commented on Sep 7, 2026

    @akoeplinger
    Member

    Moving to dotnet/runtime

  2. transferred this issue fromdotnet/dotneton Sep 7, 2026
  3. dotnet-policy-service commented on Sep 7, 2026

    @dotnet-policy-service
    Contributor

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

  4. lateralusX commented on Sep 10, 2026

    @lateralusX
    Member

    Thanks for reporting. Since these are one-time leaks, probably been around for a longer time, I will put it under Future milestone. Please feel free to submit a PR with proposed change.

  5. added this to the Future milestone on Sep 10, 2026
  6. removed
    untriagedNew issue has not been triaged by the area owner
    on Sep 10, 2026
  7. samitistfobos-dev commented on Sep 10, 2026

    @samitistfobos-dev
    ContributorAuthor

    Created pull request - 133594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions