On Jan 8, 8:06 am, EboMike <ebom...@gmail.com> wrote:
> For a simple demonstration of how BitmapFactory leaks, try this:

In the debugger, add an exception break on caught/uncaught instances
of IOException, and you will see BitmapFactory.decodeStream() calling
BufferedInputStream.reset():

        try {
            is.reset();
        } catch (IOException ex) {
            // ignore
        }

The reset() function is documented as throwing an IOException if the
mark is invalid or not set.  Apparently this happens on every attempt
to decode a file.

As a result, it's leaking the exception object, which has a reference
to the message string and an int[] array with a compact representation
of the stack trace; you can see these accumulating in the DDMS VM Heap
summary.  This is the problem I mentioned in my previous message in
this thread.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to