YES YES YES!!!
I've found solution for that.
It's tricky but it works.
Place that on the begining of your code.
try{
while (true){
Bitmap tmpBitmap = Bitmap.createBitmap(320,
4800,
Config.ARGB_8888);
}
}catch(Throwable e){
e.printStackTrace();
System.out.println("CATCHED !!!!");
}
I was fighting with that about 4 days.
Hope anyone is happy now.
Regards,
avram.
On Dec 15 2008, 8:29 pm, Mark K <[email protected]> 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 <[email protected]> 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
> >VMdecides 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):VMwon'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):VMwon'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):VMwon'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:bitmapsize
> >exceedsVMbudget
> > 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):VMwon'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):VMwon't let us allocate 65536 bytes
> > W/dalvikvm( 410): threadid=61: thread exiting with uncaught exception
> > (group=0x40010e28)
> > E/AndroidRuntime( 410):java.lang.OutOfMemoryError:bitmapsize
> >exceedsVMbudget
> > 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:bitmapsize
> >exceedsVMbudget
> > 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):VMwon'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:bitmapsize
> >exceedsVMbudget
> > 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:bitmapsize
> >exceedsVMbudget
> > 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:bitmapsize
> >exceedsVMbudget
> > 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
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---