John,
You could try forcing GC (for debugging) by creating a thread that
allocates memory in a loop, something like this:
for (;;) {
byte[] buf = new byte[100 * 1024];
Log.i(TAG, "new buf: " + buf);
Thread.Sleep(100);
}
Note that references to these byte buffers are not kept around, but the
code allocates more and more. This should force the GC at some point,
perhaps you'll see log messages from your finalize then?
And what I said about Bitmaps doesn't really apply - since you're using
Drawables.
-- Kostya
19.10.2010 4:50, John Gaby пишет:
And yet, I have objects where I log the finalize call but find, when
looking at the heap dump, those objects are gone even though I never
received a finalize log for them. I also have custom ViewGroup
objects where the memory analyzer tells me that the only references
are from it's children, and yet these objects are never freed (this
appears to be the source of my leak).
I am somewhat baffled as to what is going on here.
Thanks for your help
On Oct 18, 5:25 pm, Tom Gibara<[email protected]> wrote:
It is possible that the finalize() has been called at much later point.
I should have probably said that lack of finalize() does not mean that
the memory has not been regained.
This isn't correct. If an object is an instance of a class with a
non-trivial finalize method, then the object's memory cannot be reclaimed
until the finalizer has run.
Tom.
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en