From 5dc6b62136e03fd34ca6979369351198d23531b4 Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Sat, 6 Mar 2021 18:47:20 -0800 Subject: No longer call registerNativeAllocation The original rationale is obsolete, since contexts are now almost always shared. This call was unbalanced; there was no corresponding freeNativeAllocation call. Thus, in the rare cases in which this actually makes a difference, it's likely to lead to perpetually increasing native allocation counts, which is more likely to be confusing than helpful to the garbage collector. (Discussed with Tim and Jean-Luc, and concluded that it was best just to remove the code.) Test: Treehugger Bug: 181351667 Change-Id: I376a16732231aad0fdacd022de301464e5ac71dd --- rs/java/android/renderscript/RenderScript.java | 7 ------- 1 file changed, 7 deletions(-) (limited to 'rs/java/android/renderscript/RenderScript.java') diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index 39efe731ce8a..806a25a748e2 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -1363,13 +1363,6 @@ public class RenderScript { mApplicationContext = ctx.getApplicationContext(); } mRWLock = new ReentrantReadWriteLock(); - try { - registerNativeAllocation.invoke(sRuntime, 4 * 1024 * 1024); // 4MB for GC sake - } catch (Exception e) { - Log.e(RenderScript.LOG_TAG, "Couldn't invoke registerNativeAllocation:" + e); - throw new RSRuntimeException("Couldn't invoke registerNativeAllocation:" + e); - } - } /** -- cgit v1.2.3