summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Maunik Shah <mshah@codeaurora.org> 2014-06-19 14:18:39 +0530
committer Maunik Shah <mshah@codeaurora.org> 2014-06-19 19:44:21 +0530
commitdb1a9a3862e62ea088ced2ae04a78e515089ba7e (patch)
tree31dca876d362d8f7fdb4a0da15f5324b015b10d1
parentab9a19e38c685d0cb2952185af510322b26181a7 (diff)
Fixing parcel leaks to avoid virtual memory leak
Client has to call recycle() on parcel object after its usage otherwise native layer of binder won't clear the resources of parcel which were allocated for IPC Change-Id: Ib31ddcc92aa4ebd80bb66729922b9133692e9c9e
-rw-r--r--core/java/android/app/ApplicationThreadNative.java1
-rw-r--r--core/java/android/widget/RemoteViews.java4
2 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index cb453e22a037..badaec38524e 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -1188,6 +1188,7 @@ class ApplicationThreadProxy implements IApplicationThread {
data.writeInt(level);
mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
IBinder.FLAG_ONEWAY);
+ data.recycle();
}
public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 0d3df517490d..b2907448cac5 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -1709,7 +1709,9 @@ public class RemoteViews implements Parcelable, Filter {
Parcel p = Parcel.obtain();
writeToParcel(p, 0);
p.setDataPosition(0);
- return new RemoteViews(p);
+ RemoteViews rv = new RemoteViews(p);
+ p.recycle();
+ return rv;
}
public String getPackage() {