@walter. I put in some debug code to print out the current memory stats before every image load.
Here’s what I see:
I/Corona ( 607): Current texture memory used: 495616
I/Corona ( 607): Current memory used: 845.5205078125
I/Corona ( 607): loading sprite Intro\_BG
D/dalvikvm( 607): GC\_FOR\_ALLOC freed 22011K, 84% free 6409K/38727K, paused 43ms, total 52ms
I/dalvikvm-heap( 607): Grow heap (frag case) to 18.686MB for 12982848-byte allocation
D/dalvikvm( 607): GC\_FOR\_ALLOC freed 7K, 51% free 19081K/38727K, paused 68ms, total 68ms
D/dalvikvm( 607): GC\_CONCURRENT freed \<1K, 51% free 19081K/38727K, paused 18ms+19ms, total 111ms
D/dalvikvm( 607): GC\_FOR\_ALLOC freed 158K, 51% free 19111K/38727K, paused 45ms, total 46ms
I/dalvikvm-heap( 607): Forcing collection of SoftReferences for 12982848-byte allocation
D/dalvikvm( 607): GC\_BEFORE\_OOM freed 9K, 51% free 19101K/38727K, paused 61ms, total 62ms
E/dalvikvm-heap( 607): Out of memory on a 12982848-byte allocation.
I/dalvikvm( 607): "GLThread 75" prio=5 tid=13 RUNNABLE
I/dalvikvm( 607): | group="main" sCount=0 dsCount=0 obj=0x4104f220 self=0x2a1322c0
I/dalvikvm( 607): | sysTid=623 nice=0 sched=0/0 cgrp=apps handle=705700824
I/dalvikvm( 607): | schedstat=( 9333008975 3369863196 5385 ) utm=846 stm=87 core=0
I/dalvikvm( 607): at com.ansca.corona.NativeToJavaBridge.getBitmapAsset(NativeToJavaBridge.java:~1118)
I/dalvikvm( 607): at
Texture memory is in bytes, and memory is in kilobytes. So, in other words, Corona reports that it’s using less than 0.5MB texture memory and under 1MB CPU memory before loading the ~13MB spritesheet and crashing due to a memory error.
There are other scenes in the game that use far more memory than that, and loading those directly seems to work.
Here’s the code I used to get the memory details:
print("Current texture memory used:", system.getInfo("textureMemoryUsed"))
print("Current memory used:",collectgarbage("count") )
print("loading sprite",name)
[import]uid: 135827 topic_id: 33066 reply_id: 131637[/import]