Skip to content

Commit f5b561d

Browse files
committed
Fix math bug
1 parent 43aaf11 commit f5b561d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/libhostmgr/libhostmgr.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public func startVM(name: String) async throws {
209209
Console.success("Successfully Imported \(parallelsVM.name) with UUID \(parallelsVM.uuid)")
210210

211211
try applyVMSettings([
212-
.memorySize(Int(ProcessInfo().physicalMemory - 4096)), // This is a hack, we should make this configurable
212+
.memorySize(Int(ProcessInfo().physicalMemory / 1024 / 1024) - 4096), // We should make this configurable
213213
.cpuCount(ProcessInfo().physicalProcessorCount),
214214
.hypervisorType(.apple),
215215
.networkType(.shared),
@@ -286,7 +286,7 @@ func applyVMSettings(_ settings: [StoppedVM.VMOption], to parallelsVM: StoppedVM
286286
Console.info("Applying VM Settings")
287287

288288
// Always leave 4GB available to the VM host – the VM can have the rest
289-
let dedicatedMemoryForVM = ProcessInfo().physicalMemory - 4096 // This is a hack, we should make this configurable
289+
let dedicatedMemoryForVM = ProcessInfo().physicalMemory - (4096 * 1024 * 1024) // We should make this configurable
290290
let cpuCoreCount = ProcessInfo().physicalProcessorCount
291291

292292
Console.printTable(data: [

0 commit comments

Comments
 (0)