App runs on simulator by force closes on device, out of memory?

I have a game prototype where I have a bunch of sprite sheets and sprite sheet data that I feed into newSpriteSheetFromData. I have under 1 MB of pngs, but my sprite sheet Data contains hundreds of frames.

Looks like there’s some threshold I’m crossing where I include 1 extra spritesheet and the game force closes on the device.

Is there an upper limit to the number of sprites, sprite sheets, frames of animation on sprites or something? Is there a way to tell if I’m running out of memory? [import]uid: 27183 topic_id: 7294 reply_id: 307294[/import]

Looks like I am running out of memory. I ran adb logcat while running my app on device, and I see this exception.

I/dalvikvm-heap( 9765): Clamp target GC heap from 24.410MB to 24.000MB
D/dalvikvm( 9765): GC_EXTERNAL_ALLOC freed 68 objects / 3400 bytes in 35ms
E/dalvikvm-heap( 9765): 416-byte external allocation too large for this process.
E/GraphicsJNI( 9765): VM won’t let us allocate 416 bytes
W/dalvikvm( 9765): threadid=9: thread exiting with uncaught exception (group=0x4001d7e0)
E/AndroidRuntime( 9765): FATAL EXCEPTION: GLThread 10
E/AndroidRuntime( 9765): java.lang.NoClassDefFoundError: android.app.AlertDialog$Builder
E/AndroidRuntime( 9765): at com.ansca.corona.Controller.showNativeAlert(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.CoronaBridge.callShowNativeAlert(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.CoronaPortal.nativeResize(Native Method)
E/AndroidRuntime( 9765): at com.ansca.corona.CoronaPortal.resize(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.events.ResizeEvent.Send(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.events.EventManager.sendEvents(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.Controller.onDrawFrame(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.CoronaRenderer.onDrawFrame(Unknown Source)
E/AndroidRuntime( 9765): at android.opengl.derived.SwapGLSurfaceView$GLThread.guardedRun(Unknown Source)
E/AndroidRuntime( 9765): at android.opengl.derived.SwapGLSurfaceView$GLThread.run(Unknown Source)
E/AndroidRuntime( 9765): Caused by: java.lang.NoClassDefFoundError: com.ansca.corona.Controller$1
E/AndroidRuntime( 9765): at com.ansca.corona.Controller.startTimer(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.Controller.setTimer(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.CoronaBridge.callSetTimer(Unknown Source)
E/AndroidRuntime( 9765): … 8 more
E/AndroidRuntime( 9765): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
E/AndroidRuntime( 9765): at android.graphics.Bitmap.nativeCreate(Native Method)
E/AndroidRuntime( 9765): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
E/AndroidRuntime( 9765): at com.ansca.corona.CoronaText.render(Unknown Source)
E/AndroidRuntime( 9765): at com.ansca.corona.CoronaBridge.callGetText(Unknown Source)
E/AndroidRuntime( 9765): … 8 more
W/ActivityManager( 1296): Force finishing activity loqheart.gingervs/.MyCoronaActivity

It looks like corona was also trying to notifiy me of the problem, but is there’s a missing class?

Looks like I’m hitting a 24MB cap on the heap. Does anyone know what’s the typical amount allocated for an app?

[import]uid: 27183 topic_id: 7294 reply_id: 25702[/import]

Hi

Have you found any solution for your problem? I am getting the same error using logcat.

Cheers [import]uid: 80320 topic_id: 7294 reply_id: 73037[/import]

You need to stay under the memory limit. Whatever that happens to be for your device. [import]uid: 27183 topic_id: 7294 reply_id: 73038[/import]

Thanks,

What’s the usual memory amount for an app? How do I measure it for my app?
Any hint or tutorials to reduce memory usage in corona sdk? [import]uid: 80320 topic_id: 7294 reply_id: 73040[/import]

How much memory an app uses depends on the how much app memory and texture memory is used. So coming up with a “usual” amount doesn’t make sense unless you talk about a specific app. Search for memory profilers and optimization tips if you want to see how to measure and optimize.

Relevant link:
http://developer.anscamobile.com/content/performance-and-optimization [import]uid: 27183 topic_id: 7294 reply_id: 73050[/import]