在 SystemInfo 中采集内存信息#3903
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a unified approach for collecting and formatting memory information on Linux (and other platforms) by moving the logic into SystemInfo along with a new PhysicalMemoryStatus object and a DataSizeUnit utility. Key changes include:
- Adding parsing for /proc/meminfo in LinuxHardwareDetector.
- Introducing PhysicalMemoryStatus and DataSizeUnit for consistent memory unit conversion and display.
- Updating multiple modules (UI components, VersionSetting, Launcher, language resources, etc.) to use the new SystemInfo methods and adopt MiB/GiB units.
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/linux/LinuxHardwareDetector.java | Adds memory parsing from /proc/meminfo and new memory size methods. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/hardware/PhysicalMemoryStatus.java | New immutable class representing physical memory status. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/hardware/HardwareDetector.java | Updates memory retrieval using OperatingSystemMXBean with fallback. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/SystemInfo.java | Refactors memory collection and exposes new memory methods. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/OperatingSystem.java | Removes deprecated memory-related code. |
| HMCLCore/src/main/java/org/jackhuang/hmcl/util/DataSizeUnit.java | Introduces unit conversion and formatting for memory sizes. |
| Various UI and language files (e.g., VersionSettingsPage.java, I18N_*.properties) | Update to use new memory info methods and consistently use MiB/GiB notation. |
| Other related files (e.g., VersionSetting.java, Launcher.java, HMCLGameRepository.java) | Updates to refer to SystemInfo and new formatting in memory allocation logic. |
Comments suppressed due to low confidence (1)
HMCL/src/main/resources/assets/lang/I18N_ja.properties:510
- There appears to be a typographic error in the unit. '1024i' should likely be '1024 MiB' for consistency.
launch.advice.too_large_memory_for_32bit=32ビットJavaランタイム環境が原因で、割り当てたメモリが多すぎるため、ゲームがクラッシュする可能性があります。32ビットシステムの最大メモリ容量は1024iです.
This was referenced Jun 8, 2025
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.
No description provided.