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 object, 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"?>


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: 
http://mono-for-android.1047100.n5.nabble.com/GridView-not-releasing-view-objects-tp5078401p5078401.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to