Monday, April 23, 2012

[android-developers] Undefined behaviors due to Non-thread safe nature of Bitmaps(Skia)

Solving heap corruption/ undefined behaviors is really frustrating.

And Bitmap is one of such culprit, there are two major issues with Bitmap.

1) App developer doesn't have a clue that Bitmap is wrapped over Skia, and Skia is thread-UNSAFE.
   So, all those using Bitmap in non-UI threads (AsyncTask,..etc) are on dangerous edge of Undefined/heap-corruption ..and many more...endless issues.


2) API documentation is not well described, say for  example:
      Bitmap.createScaledBitmap() , doesn't say anywhere that it may return same source bitmap based on input parameters passed, more on this link.
    So, those believing that it always returns a new scaled bitmap, would end in race condition when passed to a non-UI thread,so a recipe for all Undefined behaviors, more over if one of thread does Bitmap.Recycle(), then no one is there to save you.

-Mark


--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate