libion: Increase allocation size in large allocation test am: 765c309109

Original change: https://android-review.googlesource.com/c/platform/system/memory/libion/+/1825288

Change-Id: I0402a1468d1413a3692fed5b9a399f330ec703aa
diff --git a/tests/allocate_test.cpp b/tests/allocate_test.cpp
index 5ed01bb..64ebaa5 100644
--- a/tests/allocate_test.cpp
+++ b/tests/allocate_test.cpp
@@ -16,6 +16,7 @@
 
 #include <sys/mman.h>
 #include <memory>
+#include <sys/sysinfo.h>
 
 #include <gtest/gtest.h>
 
@@ -90,12 +91,17 @@
 }
 
 TEST_F(Allocate, Large) {
+    struct sysinfo si;
+    ASSERT_TRUE(sysinfo(&si) != -1);
+
+    auto totalRamSize = si.totalram * si.mem_unit;
+
     for (const auto& heap : ion_heaps) {
         SCOPED_TRACE(::testing::Message()
                      << "heap:" << heap.name << ":" << heap.type << ":" << heap.heap_id);
         int fd;
         ASSERT_EQ(-ENOMEM,
-                  ion_alloc_fd(ionfd, 3UL * 1024 * 1024 * 1024, 0, (1 << heap.heap_id), 0, &fd));
+                  ion_alloc_fd(ionfd, totalRamSize, 0, (1 << heap.heap_id), 0, &fd));
     }
 }