Use default VM memory size except when compiling
The effect of this is that the VM started by compos_verify is smaller,
as well as only using 1 CPU. (It does very little, so this should be
fine.)
And that should reduce its impact on boot time.
Compilation: "--mem" "1024" "--cpus" "8"
Verification: "--mem" "1024" "--cpus" "8"
Bug: 220824234
Test: staged-apex-compile, reboot, check logs.
Change-Id: I1101965fb532abe7923ec133920d62f5eacfd108
diff --git a/compos/composd/src/instance_manager.rs b/compos/composd/src/instance_manager.rs
index f1289e8..587314c 100644
--- a/compos/composd/src/instance_manager.rs
+++ b/compos/composd/src/instance_manager.rs
@@ -32,6 +32,9 @@
use std::sync::{Arc, Mutex, Weak};
use virtualizationservice::IVirtualizationService::IVirtualizationService;
+// Enough memory to complete odrefresh in the VM.
+const VM_MEMORY_MIB: i32 = 1024;
+
pub struct InstanceManager {
service: Strong<dyn IVirtualizationService>,
state: Mutex<State>,
@@ -95,7 +98,7 @@
}
};
let cpu_set = system_properties::read(DEX2OAT_CPU_SET_PROP_NAME)?;
- Ok(VmParameters { cpus, cpu_set, ..Default::default() })
+ Ok(VmParameters { cpus, cpu_set, memory_mib: Some(VM_MEMORY_MIB), ..Default::default() })
}
// Ensures we only run one instance at a time.