-
Notifications
You must be signed in to change notification settings - Fork 899
修复自动分配内存逻辑异常的问题 #6356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
修复自动分配内存逻辑异常的问题 #6356
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -544,7 +544,7 @@ else if (violatedMandatoryConstraints.contains(JavaVersionConstraint.VANILLA)) | |
| } | ||
|
|
||
| if (violatedMandatoryConstraints.contains(JavaVersionConstraint.VANILLA_LINUX_JAVA_8)) { | ||
| if (!setting.get(GameSettings::useCustomNativesProperty)) { | ||
| if (!setting.getInheritable(GameSettings::useCustomNativesProperty)) { | ||
| FXUtils.runInFX(() -> Controllers.dialog(i18n("launch.advice.vanilla_linux_java_8"), i18n("message.error"), MessageType.ERROR, breakAction)); | ||
| return result; | ||
| } else { | ||
|
|
@@ -581,7 +581,7 @@ else if (violatedMandatoryConstraints.contains(JavaVersionConstraint.VANILLA)) | |
| } | ||
|
|
||
| // 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 Useful? React with 👍 / 👎. |
||
| // 1.5 * 1024 is an inaccurate number. | ||
| // Actual memory limit depends on operating system and memory. | ||
| suggestions.add(i18n("launch.advice.too_large_memory_for_32bit")); | ||
|
|
@@ -628,7 +628,7 @@ else if (violatedMandatoryConstraints.contains(JavaVersionConstraint.VANILLA)) | |
| suggestions.add(i18n("launch.advice.modlauncher8")); | ||
| break; | ||
| case VANILLA_X86: | ||
| if (!setting.get(GameSettings::useCustomNativesProperty) | ||
| if (!setting.getInheritable(GameSettings::useCustomNativesProperty) | ||
| && Platform.isSupportedTranslationX86_64()) { | ||
| suggestions.add(i18n("launch.advice.vanilla_x86.translation")); | ||
| } | ||
|
|
@@ -640,7 +640,7 @@ else if (violatedMandatoryConstraints.contains(JavaVersionConstraint.VANILLA)) | |
|
|
||
| // Cannot allocate too much memory exceeding free space. | ||
| long totalMemorySizeMB = (long) MEGABYTES.convertFromBytes(SystemInfo.getTotalMemorySize()); | ||
| if (totalMemorySizeMB > 0 && totalMemorySizeMB < setting.getMaxMemory()) { | ||
| if (totalMemorySizeMB > 0 && !setting.getInheritable(GameSettings::autoMemoryProperty) && totalMemorySizeMB < setting.getMaxMemory()) { | ||
| suggestions.add(i18n("launch.advice.not_enough_space", totalMemorySizeMB)); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When auto memory is enabled this now derives
-Xmxonly from current available RAM, ignoring the effectivemaxMemoryvalue. That value is still used as a required floor elsewhere: the MCBBS post-install task writesmanifest.getLaunchInfo().getMinMemory()intomaxMemorywhile 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 👍 / 👎.