From 3ffccab78666d8960c10a00239de6bb40f4fb1b6 Mon Sep 17 00:00:00 2001 From: Johannes Carlsson Date: Wed, 27 Oct 2010 08:28:14 +0200 Subject: [PATCH] Release reference when putting RILRequest back into the pool. In order to reduce object creation the RILRequest objects are stored in an array when it is unused (max 4). This avoids GC of the object. The object in turn has references to other objects which sometimes hold large memory chunks. This fix releases these references since they are not used anyway. This will make it possible to GC the Message (mResult) which in some cases holds references to a Bitmap which sometimes leads to OutOfMemoryException. The reference is cleared anyway in RILRequest.obtain(...) Change-Id: I3b895bc39b5e2f3ab7cc8297c3583ea78e0ebc77 --- telephony/java/com/android/internal/telephony/RIL.java | 1 + 1 file changed, 1 insertion(+) diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index a9a4be2a8f8dc..2f7aa214bbdec 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -141,6 +141,7 @@ class RILRequest { this.mNext = sPool; sPool = this; sPoolSize++; + mResult = null; } } }