Skip to content

[release/3.6] 修复多次启动游戏时内存泄露的问题#4423

Merged
Glavo merged 1 commit intoHMCL-dev:releasefrom
Glavo:backport/4121
Sep 10, 2025
Merged

[release/3.6] 修复多次启动游戏时内存泄露的问题#4423
Glavo merged 1 commit intoHMCL-dev:releasefrom
Glavo:backport/4121

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Sep 10, 2025

Co-authored-by: Glavo <zjx001202@gmail.com>
@Glavo Glavo added the backport label Sep 10, 2025
@Glavo Glavo requested a review from Copilot September 10, 2025 12:24
Copy link
Contributor

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 fixes a memory leak issue that occurs when starting games multiple times by implementing weak references for process management.

  • Changes the process storage mechanism from strong references to weak references to allow garbage collection
  • Adds cleanup logic to remove dead weak references from the process queue
  • Updates process management methods to work with the new weak reference structure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}

private void launch0() {
// https://github.com/HMCL-dev/HMCL/pull/4121
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

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

[nitpick] The comment should be more descriptive about what this code does. Consider changing it to something like '// Clean up dead weak references to prevent memory leaks' to better explain the purpose of this cleanup operation.

Suggested change
// https://github.com/HMCL-dev/HMCL/pull/4121
// https://github.com/HMCL-dev/HMCL/pull/4121
// Clean up dead weak references to prevent memory leaks

Copilot uses AI. Check for mistakes.
@Glavo Glavo merged commit 708e032 into HMCL-dev:release Sep 10, 2025
2 checks passed
@Glavo Glavo deleted the backport/4121 branch September 10, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants