修复自动分配内存逻辑异常的问题#6356
Conversation
…tings for improved memory management
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 962b0a2252
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (autoMemory) { | ||
| maxMemory = noJVMOptions | ||
| ? null | ||
| : Math.toIntExact(getAutoAllocatedMemory(SystemInfo.getPhysicalMemoryStatus().available()) / 1024L / 1024L); |
There was a problem hiding this comment.
Preserve memory floors for auto allocation
When auto memory is enabled this now derives -Xmx only from current available RAM, ignoring the effective maxMemory value. That value is still used as a required floor elsewhere: the MCBBS post-install task writes manifest.getLaunchInfo().getMinMemory() into maxMemory while preserving the effective auto-memory setting. For a pack that requires e.g. 6 GiB on a machine where the auto heuristic suggests 2 GiB, launch gets the 2 GiB heap and can fail despite the installer recording the modpack's minimum.
Useful? React with 👍 / 👎.
|
|
||
| // 32-bit JVM cannot make use of too much memory. | ||
| if (java.getBits() == Bits.BIT_32 && setting.getMaxMemory() > 1.5 * 1024) { | ||
| if (java.getBits() == Bits.BIT_32 && !setting.getInheritable(GameSettings::autoMemoryProperty) && setting.getMaxMemory() > 1.5 * 1024) { |
There was a problem hiding this comment.
Warn for oversized auto memory on 32-bit JVMs
With a 32-bit Java runtime and auto memory enabled, the new auto-memory path can still choose more than the 32-bit heap limit when the machine has several GiB free, but this condition now suppresses the existing warning. In that scenario HMCL proceeds with an oversized -Xmx without telling the user why the launch may fail; the check should use the computed auto allocation rather than skipping auto mode entirely.
Useful? React with 👍 / 👎.
No description provided.