Make kHugeNativeAllocs configurable
Add -XX:StopForNativeAllocs command line argument to replace
kHugeNativeAllocs constant.
The default remains at 1 GB. But This default will allow small
memory devices to run out of memory if we allocate Java owned native
memory faster than what the GC can keep up with. Setting it to
a smaller value should prevent that.
Bug: 122552730
Test: Boot AOSP, Treehugger
Change-Id: I5c84b2f1f67038e1b7a0ca3f5fc08090359c5f3e
diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def
index 4488680..a7b5f34 100644
--- a/runtime/runtime_options.def
+++ b/runtime/runtime_options.def
@@ -51,6 +51,7 @@
RUNTIME_OPTIONS_KEY (MemoryKiB, HeapMinFree, gc::Heap::kDefaultMinFree)
RUNTIME_OPTIONS_KEY (MemoryKiB, HeapMaxFree, gc::Heap::kDefaultMaxFree)
RUNTIME_OPTIONS_KEY (MemoryKiB, NonMovingSpaceCapacity, gc::Heap::kDefaultNonMovingSpaceCapacity)
+RUNTIME_OPTIONS_KEY (MemoryKiB, StopForNativeAllocs, 1 * GB)
RUNTIME_OPTIONS_KEY (double, HeapTargetUtilization, gc::Heap::kDefaultTargetUtilization)
RUNTIME_OPTIONS_KEY (double, ForegroundHeapGrowthMultiplier, gc::Heap::kDefaultHeapGrowthMultiplier)
RUNTIME_OPTIONS_KEY (unsigned int, ParallelGCThreads, 0u)