Size the leak test allocation base on memory class.

bug 11566001

This will avoid early failure on low memory devices.

Change-Id: I67a3831b010bcb56aa70a477170dd5090328dcaa
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/LeakTest.java b/tests/tests/renderscript/src/android/renderscript/cts/LeakTest.java
index ce9153b..b8c133a 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/LeakTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/LeakTest.java
@@ -16,10 +16,12 @@
 
 package android.renderscript.cts;
 
+import android.app.ActivityManager;
 import android.renderscript.Allocation;
 import android.renderscript.Element;
 import android.renderscript.Type;
 import android.util.Log;
+import android.content.Context;
 
 /*
 // -target-api 11
@@ -44,10 +46,16 @@
  * bug, since it may have been compiled without .rs.dtor() support.
  */
 public class LeakTest extends RSBaseCompute {
-    private final static int x = 16 * 1024 * 1024;
     private static final String TAG = "LeakTest";
 
     public void testForLeaks() {
+        ActivityManager am = (ActivityManager) getContext().getSystemService("activity");
+        int mc = am.getLargeMemoryClass() / 32;
+        if (mc < 1) {
+            mc = 1;
+        }
+        int x = mc * 1024 * 1024;
+
         for (int i = 0; i < 100; i++) {
             Log.w(TAG, "Leak test iteration " + i);
             ScriptC_leak leak = new ScriptC_leak(mRS);