Repository navigation
feat: 新增 HMCLMonitor 子项目,降低启动器隐藏时的内存占用 - #6930
Draft
fishdry1000 wants to merge 22 commits into
Draft
fishdry1000 wants to merge 22 commits into
fishdry1000 wants to merge 22 commits into
Conversation
ManagedProcess 实现 ProcessInfo,Launcher#launch、ProcessListener 及启动事件改用 ProcessInfo,GameCrashWindow、LogWindow、LauncherHelper、HMCLGameLauncher 随之适配;并从 UpdateHandler 提取 JavaProcessLauncher 至 HMCLCore。
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Contributor
Contributor
Author
这个是构建项目的进程,gradlew run 就会有。你可以看下,两张图都有一个 ~800M 的 java 进程。至于为什么一会后台一会前台我就不是很清楚了 |
fishdry1000
marked this pull request as draft
October 11, 2026 13:35
Contributor
Author
|
还有些地方有点问题,我这两天修一下 edit: 拖延症犯了,在拖几天 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


参见 #4216
Important
当前特性需设置
HMCL_USE_HMCLMONITOR环境变量启用效果
不设置

HMCL_USE_HMCLMONITOR:HMCL 常驻占用 ~400MB
设置

HMCL_USE_HMCLMONITOR:HMCL 常驻占用 ~45MB
启动器可见性:隐藏启动器并在游戏启动后重新打开
显示日志:关
系统:Windows 11 25H2
本机测试 HMCL 内存占用降低 ~85%
新增内容
新 Gradle 子项目
HMCLMonitor依赖
HMCLCore,与HMCLBoot以同样方式打包进 HMCL 主 jar。主项目启动游戏时,将启动参数写入 specFile,同时启动一个带参数的 HMCL 进程,主进程按照可见性退出。
使用
--monitor <specFile>参数启动 HMCL 以使用 HMCLMonitor。此模式下,不初始化 HMCL 的大部分功能,并能:specFile 见 ProcessSpec.java
新 HMCL 启动模式
使用
--crash-report <resultFile>读取HMCLMonitor生成的游戏进程报告,并在启动后弹出一个崩溃窗口。resultFile 见 ResultSpec.java
修改内容
HMCLCore: 重构游戏进程视图
新增
ProcessInfo接口,统一 “本 JVM 直接持有的游戏进程” (ManagedProcess) 与 “monitor 代管的游戏进程” (MonitorGameProcess) 的视图,相关 API 签名从ManagedProcess改为ProcessInfo。HMCLCore: 提取实用方法
将
UpdateHandler中 “复用当前 JVM 参数拉起新 java 进程” 的逻辑提取为JavaProcessLauncher,由UpdateHandler与 monitor 共用。