Depending on the details, bitmap pixels may be allocated in the VM  
heap or in the native heap, but in the latter case, we still debit the  
VM's heap by the amount that was allocated, so that in either case we  
don't exceed the per-app budget. This may explain why you're running  
out of heap even though DDMS doesn't see the allocations.


On Dec 15, 2008, at 2:29 PM, Mark K wrote:



  I've run into this exact same problem a number of times myself. Not
sure if its a bug or just a limitation of the jvm, can't seem to
process more than a few large bitmaps without this occuring, this
always seems to occur when decoding bitmaps from file. Hopefully its
on the radar as a bug and will get fixed at some point. This is a
problem since de-coding bitmaps from file is a fairly common
operation.

                              Mark

On Dec 14, 9:49 am, plusminus <stoeps...@gmx.de> wrote:
> The following situation happens only in a few cases, but it does more
> than once.
> ---------------------------------
>
> I'm receiving several OutOfMemoryError in
> BitmapFactory.nativeDecodeByteArray.
>
> DDMS-Heap-View never broke the 16MB barrier. I can't even get it above
> 6MB, while going wild and smashing keys like a monkey:
> -----------------------------------
> 1       5,820 MB        2,751 MB        3,069 MB        47,26%  54.433
> -----------------------------------
>
> The situation is that I have a ThreadPoolExector:
> -----------------------------------
> protected ExecutorService mThreadPool = Executors.newCachedThreadPool
> ();
> -----------------------------------
> ... ,which load several 256x256 pngs to the RAM. (Average png-size: <
> 20kb)
>
> StackTrace-Desciption:
> That OutOfMemoryError happens several times in the Threads, until the
> VM decides its enough and stops the whole process.
>
> StackTrace:
> #################################
> W/AudioFlinger(   24): write blocked for 49 msecs
> W/AudioFlinger(   24): write blocked for 48 msecs
> W/AudioFlinger(   24): write blocked for 49 msecs
> D/dalvikvm(  410): GC freed 31478 objects / 1613104 bytes in 196ms
> D/dalvikvm(  410): GC freed 6404 objects / 991024 bytes in 151ms
> D/dalvikvm(  410): GC freed 5224 objects / 1229888 bytes in 137ms
> E/SOCKETLOG(  410): add_recv_stats recv 0
> E/SOCKETLOG(  410): add_recv_stats recv 0
> E/SOCKETLOG(  410): add_recv_stats recv 0
> E/SOCKETLOG(  410): add_recv_stats recv 0
> E/dalvikvm-heap(  410): 65536-byte external allocation too large for
> this process.
> E/dalvikvm-heap(  410): 65536-byte external allocation too large for
> this process.
> E/        (  410): VM won't let us allocate 65536 bytes
> W/dalvikvm(  410): threadid=59: thread exiting with uncaught exception
> (group=0x40010e28)
> E/AndroidRuntime(  410): Uncaught handler: thread pool-8-thread-6
> exiting due to uncaught exception
> E/        (  410): VM won't let us allocate 65536 bytes
> E/dalvikvm-heap(  410): 65536-byte external allocation too large for
> this process.
> W/dalvikvm(  410): threadid=65: thread exiting with uncaught exception
> (group=0x40010e28)
> E/dalvikvm-heap(  410): 65536-byte external allocation too large for
> this process.
> E/        (  410): VM won't let us allocate 65536 bytes
> W/dalvikvm(  410): threadid=43: thread exiting with uncaught exception
> (group=0x40010e28)
> E/AndroidRuntime(  410): Uncaught handler: thread pool-8-thread-3
> exiting due to uncaught exception
> E/AndroidRuntime(  410): java.lang.OutOfMemoryError: bitmap size
> exceeds VM budget
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:234)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:247)
> E/AndroidRuntime(  410):        at
> org.andnav2.osm.views.tiles.OSMMapTileFilesystemCache$1.run
> (OSMMapTileFilesystemCache.java:234)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:648)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:673)
> E/AndroidRuntime(  410):        at java.lang.Thread.run(Thread.java:
> 935)
> E/        (  410): VM won't let us allocate 65536 bytes
> E/AndroidRuntime(  410): Uncaught handler: thread pool-8-thread-9
> exiting due to uncaught exception
> E/dalvikvm-heap(  410): 65536-byte external allocation too large for
> this process.
> E/        (  410): VM won't let us allocate 65536 bytes
> W/dalvikvm(  410): threadid=61: thread exiting with uncaught exception
> (group=0x40010e28)
> E/AndroidRuntime(  410): java.lang.OutOfMemoryError: bitmap size
> exceeds VM budget
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:234)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:247)
> E/AndroidRuntime(  410):        at
> org.andnav2.osm.views.tiles.OSMMapTileFilesystemCache$1.run
> (OSMMapTileFilesystemCache.java:234)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:648)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:673)
> E/AndroidRuntime(  410):        at java.lang.Thread.run(Thread.java:
> 935)
> E/dalvikvm-heap(  410): 65536-byte external allocation too large for
> this process.
> E/AndroidRuntime(  410): java.lang.OutOfMemoryError: bitmap size
> exceeds VM budget
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:234)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:247)
> E/AndroidRuntime(  410):        at
> org.andnav2.osm.views.tiles.OSMMapTileFilesystemCache$1.run
> (OSMMapTileFilesystemCache.java:234)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:648)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:673)
> E/AndroidRuntime(  410):        at java.lang.Thread.run(Thread.java:
> 935)
> E/        (  410): VM won't let us allocate 65536 bytes
> I/Process (   50): Sending signal. PID: 410 SIG: 3
> I/dalvikvm(  410): threadid=7: reacting to signal 3
> I/dalvikvm(  410): Wrote stack trace to '/data/anr/traces.txt'
> W/dalvikvm(  410): threadid=73: thread exiting with uncaught exception
> (group=0x40010e28)
> E/AndroidRuntime(  410): Uncaught handler: thread pool-8-thread-10
> exiting due to uncaught exception
> E/AndroidRuntime(  410): java.lang.OutOfMemoryError: bitmap size
> exceeds VM budget
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:234)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:247)
> E/AndroidRuntime(  410):        at
> org.andnav2.osm.views.tiles.OSMMapTileFilesystemCache$1.run
> (OSMMapTileFilesystemCache.java:234)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:648)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:673)
> E/AndroidRuntime(  410):        at java.lang.Thread.run(Thread.java:
> 935)
> I/Process (   50): Sending signal. PID: 410 SIG: 3
> W/ActivityManager(   50): Process org.andnav2 has crashed too many
> times: killing!
> D/ActivityManager(   50):   Force finishing activity
> org.andnav2/.ui.map.OpenStreetDDMap
> E/AndroidRuntime(  410): Uncaught handler: thread pool-8-thread-7
> exiting due to uncaught exception
> E/AndroidRuntime(  410): java.lang.OutOfMemoryError: bitmap size
> exceeds VM budget
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:234)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:247)
> E/AndroidRuntime(  410):        at
> org.andnav2.osm.views.tiles.OSMMapTileFilesystemCache$1.run
> (OSMMapTileFilesystemCache.java:234)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:648)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:673)
> E/AndroidRuntime(  410):        at java.lang.Thread.run(Thread.java:
> 935)
> W/dalvikvm(  410): threadid=63: thread exiting with uncaught exception
> (group=0x40010e28)
> E/AndroidRuntime(  410): Uncaught handler: thread pool-8-thread-8
> exiting due to uncaught exception
> E/AndroidRuntime(  410): java.lang.OutOfMemoryError: bitmap size
> exceeds VM budget
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:234)
> E/AndroidRuntime(  410):        at
> android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:247)
> E/AndroidRuntime(  410):        at
> org.andnav2.osm.views.tiles.OSMMapTileFilesystemCache$1.run
> (OSMMapTileFilesystemCache.java:234)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:648)
> E/AndroidRuntime(  410):        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:673)
> E/AndroidRuntime(  410):        at java.lang.Thread.run(Thread.java:
> 935)
> D/ActivityManager(   50):   Force finishing activity
> org.andnav2/.ui.sd.SDPOISearchList
> D/ActivityManager(   50):   Force finishing activity
> org.andnav2/.ui.sd.SDPOICategories
> D/ActivityManager(   50):   Force finishing activity
> org.andnav2/.ui.sd.SDMainChoose
> D/ActivityManager(   50):   Force finishing activity
> org.andnav2/.ui.Menu
> I/dalvikvm(  410): threadid=7: reacting to signal 3
> D/ActivityManager(   50): Force removing process ProcessRecord
> {436057c0 410:org.andnav2/10023} (org.andnav2/10023)
> I/Process (   50): Sending signal. PID: 410 SIG: 9
> W/ActivityManager(   50): Some application object
> android.os.binderpr...@435a2848 tag AndroidRuntime has crashed, but I
> don't know who it is.
> W/ActivityManager(   50): ShortMsg:bitmap size exceeds VM budget
> W/ActivityManager(   50): LongMsg:java.lang.OutOfMemoryError: bitmap
> size exceeds VM budget
> W/ActivityManager(   50): Some application object
> android.os.binderpr...@435a2848 tag AndroidRuntime has crashed, but I
> don't know who it is.
> W/ActivityManager(   50): ShortMsg:bitmap size exceeds VM budget
> W/ActivityManager(   50): LongMsg:java.lang.OutOfMemoryError: bitmap
> size exceeds VM budget
> W/ActivityManager(   50): Some application object
> android.os.binderpr...@435a2848 tag AndroidRuntime has crashed, but I
> don't know who it is.
> W/ActivityManager(   50): ShortMsg:bitmap size exceeds VM budget
> W/ActivityManager(   50): LongMsg:java.lang.OutOfMemoryError: bitmap
> size exceeds VM budget
> D/ActivityManager(   50): Received spurious death notification for
> thread android.os.binderpr...@435a2848
> I/WindowManager(   50): WIN DEATH: Window{433b05e8 org.andnav2/
> org.andnav2.ui.map.OpenStreetDDMap}
> I/WindowManager(   50): WIN DEATH: Window{434330b0 org.andnav2/
> org.andnav2.ui.Menu}



--~--~---------~--~----~------------~-------~--~----~
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