Skip to content

Commit

Permalink
fix: Java memory assignment is not aligned
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Jun 26, 2023
1 parent 67c28a7 commit 774437a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions xmcl-keystone-ui/src/composables/instanceEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ export function useInstanceEdit(instance: Ref<Instance | undefined>) {
const isGlobalHideLauncher = computed(() => data.hideLauncher === undefined)
const isGlobalShowLog = computed(() => data.showLog === undefined)
const resetAssignMemory = () => {
data.assignMemory = undefined
data.minMemory = undefined
data.maxMemory = undefined
set(data, 'assignMemory', undefined)
set(data, 'minMemory', undefined)
set(data, 'maxMemory', undefined)
}
const resetVmOptions = () => {
set(data, 'vmOptions', undefined)
Expand Down Expand Up @@ -129,21 +129,21 @@ export function useInstanceEdit(instance: Ref<Instance | undefined>) {
if (current.fileApi !== data.fileServerApi) {
return true
}
if (current.minMemory !== data.minMemory) {
if (current.assignMemory !== data.assignMemory) {
return true
}
if (current.minMemory !== data.minMemory) {
return data.assignMemory === true
}
if (current.maxMemory !== data.maxMemory) {
return true
return data.assignMemory === true
}
if (current.vmOptions?.join(' ') !== data.vmOptions) {
return true
}
if (current.mcOptions?.join(' ') !== data.mcOptions) {
return true
}
if (current.assignMemory !== data.assignMemory) {
return true
}
if (current.version !== data.version) {
return true
}
Expand Down
4 changes: 2 additions & 2 deletions xmcl-keystone-ui/src/views/SettingJavaMemory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ const mem = computed({
return [minMemory.value, maxMemory.value]
},
set(mem: [number, number]) {
emit('update:min', mem[0] / 1024 / 1024)
emit('update:max', mem[1] / 1024 / 1024)
emit('update:min', Math.floor(mem[0] / 1024 / 1024))
emit('update:max', Math.floor(mem[1] / 1024 / 1024))
},
})
Expand Down
2 changes: 1 addition & 1 deletion xmcl-runtime/lib/services/LaunchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class LaunchService extends StatefulService<LaunchState> implements ILaun
minMemory = assignMemory === true && minMemory > 0
? minMemory
: assignMemory === 'auto' ? Math.floor((await this.baseService.getMemoryStatus()).free / 1024 / 1024 - 256) : undefined
maxMemory = assignMemory === true && maxMemory > 0 ? instance.maxMemory : undefined
maxMemory = assignMemory === true && maxMemory > 0 ? maxMemory : undefined
const prechecks = [LaunchPrecheck.checkNatives, LaunchPrecheck.linkAssets]
const accessToken = user.user ? await this.userTokenStorage.get(user.user).catch(() => undefined) : undefined

Expand Down

0 comments on commit 774437a

Please sign in to comment.