зеркало из https://github.com/mono/mail-archives.git
132 строки
4.6 KiB
HTML
132 строки
4.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [mono-android] GridView not releasing view objects
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20GridView%20not%20releasing%20view%20objects&In-Reply-To=1323974931024-5078404.post%40n5.nabble.com">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="007880.html">
|
|
<LINK REL="Next" HREF="007886.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[mono-android] GridView not releasing view objects</H1>
|
|
<B>HSSoftware</B>
|
|
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20GridView%20not%20releasing%20view%20objects&In-Reply-To=1323974931024-5078404.post%40n5.nabble.com"
|
|
TITLE="[mono-android] GridView not releasing view objects">david at headstandsoftware.com
|
|
</A><BR>
|
|
<I>Thu Dec 15 13:52:24 EST 2011</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="007880.html">[mono-android] GridView not releasing view objects
|
|
</A></li>
|
|
<LI>Next message: <A HREF="007886.html">[mono-android] GridView not releasing view objects
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#7881">[ date ]</a>
|
|
<a href="thread.html#7881">[ thread ]</a>
|
|
<a href="subject.html#7881">[ subject ]</a>
|
|
<a href="author.html#7881">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>Sorry again, formatting got mangled ...
|
|
|
|
I have an activity, whose content view includes a GridView. This GridView is
|
|
backed up by a custom adapter derived from 'Java.Lang.Object, IListAdapter'.
|
|
The data set behind the adapter include maybe 2300 objects, though only 80
|
|
views are visible at a time on the screen, thus the adapter should only be
|
|
generating 80 or so views at a time. Each view comes from a layout,
|
|
referencing a custom view, that is simply a subclass of ImageView:
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<aakf.screens.wallscreen.WorkThumbImageView
|
|
xmlns:android="<A HREF="http://schemas.android.com/apk/res/android"">http://schemas.android.com/apk/res/android"</A>
|
|
android:id="@+id/Thumbnail_ImageView"
|
|
android:layout_width="100dip"
|
|
android:layout_height="100dip"
|
|
android:scaleType="centerCrop"
|
|
android:paddingBottom="2dip"
|
|
android:paddingTop="2dip"
|
|
android:paddingLeft="2dip"
|
|
android:paddingRight="2dip"
|
|
android:background="#A0A0A0"
|
|
android:cropToPadding="true"
|
|
/>
|
|
|
|
Everything works fine, the images display, I can scroll and all. Rotation
|
|
works fine. No problem. But if you keep rotating, and rotating, and
|
|
rotating, there is a memory leak.
|
|
|
|
I generated an HPROF, looked at it with Eclipse Memory Analyzer and ...
|
|
|
|
4,296 instances of "aakf.screens.wallscreen.WorkThumbImageView", loaded by
|
|
"dalvik.system.PathClassLoader @ 0x40515960" occupy 2,884,760 (42.03%)
|
|
bytes.
|
|
|
|
Keywords dalvik.system.PathClassLoader
|
|
0x40515960 aakf.screens.wallscreen.WorkThumbImageView
|
|
|
|
It appears that when the activity is being destroyed upon rotation, somehow
|
|
the GridView is not releasing instances of WorkThumbImageView that had been
|
|
created! I checked, and indeed the activities are being OnDestroy'ed as I
|
|
rotate.
|
|
|
|
Something wrong in my layout? Something special I need to do in the
|
|
WorkThumbImageView class? I have attached the class.
|
|
|
|
--
|
|
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/GridView-not-releasing-view-objects-tp5078401p5078410.html">http://mono-for-android.1047100.n5.nabble.com/GridView-not-releasing-view-objects-tp5078401p5078410.html</A>
|
|
Sent from the Mono for Android mailing list archive at Nabble.com.
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="007880.html">[mono-android] GridView not releasing view objects
|
|
</A></li>
|
|
<LI>Next message: <A HREF="007886.html">[mono-android] GridView not releasing view objects
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#7881">[ date ]</a>
|
|
<a href="thread.html#7881">[ thread ]</a>
|
|
<a href="subject.html#7881">[ subject ]</a>
|
|
<a href="author.html#7881">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
|
|
mailing list</a><br>
|
|
</body></html>
|