Skip to content

Conversation

amnguye
Copy link
Member

@amnguye amnguye commented Oct 2, 2025

Part of attempt to resolve potential memory leak and encourage garbage clean up.

  • Set Delegates to null at cleanup to let go of resources
  • Set TransferManager to null after it becomes unnecessary to continue using
  • Catch and log exception in the case that a process throws an error

Related to #51637

@Copilot Copilot AI review requested due to automatic review settings October 2, 2025 22:00
Copy link
Contributor

@Copilot Copilot AI left a comment

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 addresses potential memory leaks in the Azure Storage DataMovement SDK by implementing proper resource cleanup and disposal patterns. The changes focus on nullifying delegate references and ensuring TransferManager instances are properly disposed.

Key changes:

  • Set delegate process to null in ChannelProcessing cleanup to release references
  • Set TransferManager reference to null in TransferInternalState after completion
  • Updated all test classes to use await using pattern for TransferManager disposal

Reviewed Changes

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

Show a summary per file
File Description
TransferInternalState.cs Nullifies TransferManager reference after transfer completion to release resources
ChannelProcessing.cs Sets delegate process to null during cleanup to release references
DownloadChunkHandler.cs Improves error handling with proper async/await pattern and logging
CommitChunkHandler.cs Improves error handling with proper async/await pattern and logging
DataMovementEventSource.cs Adds new event for logging unexpected transfer failures
Test files (multiple) Updates all test classes to use await using for proper TransferManager disposal
Sample and documentation files Updates examples to use await using pattern for TransferManager

@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Oct 2, 2025
@amnguye amnguye changed the title [Storage] [DataMovement] Setting delegate process to null and objects to null; Update tests to dispose TransferManager [Storage] [DataMovement] Setting delegate process to null and objects to null Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant