Disable Homogeneous space for dex2oat

Disable the Hspace compact can help reduce the virtual memory space
for dex2oat by not mmap the main_space_2.
This can avoid some mmap fail when dex2oat create heap.

Change-Id: I4573bd80b807f40337d40d95a8e098da94946692
Signed-off-by: Lin Zang <lin.zang@intel.com>
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index ea54239..855e545 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -2035,6 +2035,10 @@
     // Disable libsigchain. We don't don't need it during compilation and it prevents us
     // from getting a statically linked version of dex2oat (because of dlsym and RTLD_NEXT).
     raw_options.push_back(std::make_pair("-Xno-sig-chain", nullptr));
+    // Disable Hspace compaction to save heap size virtual space.
+    // Only need disable Hspace for OOM becasue background collector is equal to
+    // foreground collector by default for dex2oat.
+    raw_options.push_back(std::make_pair("-XX:DisableHSpaceCompactForOOM", nullptr));
 
     if (!Runtime::ParseOptions(raw_options, false, runtime_options)) {
       LOG(ERROR) << "Failed to parse runtime options";