Skip to content

Refactor DbgTransportTarget usage to eliminate dynamic allocation. - #122011

Merged
jkotas merged 1 commit into
dotnet:mainfrom
AaronRobinsonMSFT:remove_alloc_on_load
Nov 27, 2025
Merged

jkotas merged 1 commit into
dotnet:mainfrom
AaronRobinsonMSFT:remove_alloc_on_load

Conversation

@AaronRobinsonMSFT

Copy link
Copy Markdown
Member

Remove unused interface and header.

@AaronRobinsonMSFT

Copy link
Copy Markdown
Member Author

/cc @dotnet/dotnet-diag-contrib

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the DbgTransportTarget usage in the CoreCLR debugger infrastructure to eliminate dynamic memory allocation. The global instance is changed from a pointer (g_pDbgTransportTarget) to a value (g_DbgTransportTarget), simplifying the code by removing heap allocation, null checks, and manual cleanup. Additionally, the unused header file coreclrremotedebugginginterfaces.h and its forward declaration of ICoreClrDebugTarget are removed.

Key Changes

  • Converted global DbgTransportTarget from pointer-based to value-based storage
  • Updated all usage sites to take the address of the global instance
  • Removed unused interface declaration and header file

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/debug/inc/coreclrremotedebugginginterfaces.h Deleted unused header containing forward declaration of ICoreClrDebugTarget
src/coreclr/debug/di/dbgtransportmanager.h Changed extern declaration from pointer to value and removed include of deleted header
src/coreclr/debug/di/dbgtransportmanager.cpp Changed global definition from pointer to value with aggregate initialization and removed include of deleted header
src/coreclr/debug/di/cordb.cpp Simplified DLL initialization/cleanup by removing heap allocation, null checks, and manual delete
src/coreclr/debug/di/shimremotedatatarget.cpp Updated to take address of global value instead of using pointer directly
src/coreclr/debug/di/remoteeventchannel.cpp Updated to take address of global value instead of using pointer directly
src/coreclr/debug/di/dbgtransportpipeline.cpp Updated two locations to take address of global value instead of using pointer directly

@jkotas
jkotas enabled auto-merge (squash) November 27, 2025 01:14
@jkotas
jkotas merged commit 9ec8711 into dotnet:main Nov 27, 2025
@AaronRobinsonMSFT
AaronRobinsonMSFT deleted the remove_alloc_on_load branch November 27, 2025 04:43
@steveisok

Copy link
Copy Markdown
Member

Thanks @AaronRobinsonMSFT!

@github-actions github-actions Bot locked and limited conversation to collaborators Dec 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants