Max Texture Memory

I’ve been hearing (well, reading) a lot about texture memory and how your app with Corona should be as low as possible. My question is what’s the max texture memory for devices? I know it varies for Android device, but is there a good ‘rule of thumb’? What about the iPhone?

[code]
local monitorMem = function()

collectgarbage(“collect”)
print( "\nMemUsage: " … collectgarbage(“count”) )
local textMem = system.getInfo( “textureMemoryUsed” ) / 1000000
print( "TexMem: " … textMem )

end

local memTimer = timer.performWithDelay(1000, monitorMem, -1)
[/code] [import]uid: 108842 topic_id: 19701 reply_id: 319701[/import]

Keeping it under 25MB seems to be the general rule - that comes from the 3GS which starts to suffer if you hit 25MB. Under that it should run well on most/all devices we support.

Obviously the lower the better.

Peach :slight_smile: [import]uid: 52491 topic_id: 19701 reply_id: 76189[/import]

What about iPhone 4s? Are we able to target only iPhone 4/4s devices?

Thank you for your quick answer! [import]uid: 108842 topic_id: 19701 reply_id: 76193[/import]

A game I was working on only started crashing on iPad when going over 100MB texture memory. That’s right, 100MB. Until then it did work fine, but there were memory warnings on the debugging console. On iPhone 3GS it started crashing at about 80MB. Performance never suffered a bit, until the crashes, in the case of that particular game. On Android it will always be limited by the Java VM Max Heap Size value which is usually 32MB in compatible phones (2.2+) and 48MB on Tegra based tablets. The thing is that this is the total memory a program may use at any given time, so your texture memory usage should be lower than this. About 24MB seems to run on all devices so far.
If you’re targeting iPhone4/S and iPad only then you can probably go all the way to 64MB without worries. The best way to know for sure is to “listen” for memory warnings when running on the device.
PS: If you can guarantee that you NEVER load more than the aforementioned 24MB of textures at once on an Android device you can use a lot more texture memory than that. This is because once the images are loaded into memory they will be garbage collected from the Java heap, because the rendering process is all native code. Java is only needed to load the images into memory if I understood correctly the way Corona works on Android. [import]uid: 61899 topic_id: 19701 reply_id: 76197[/import]

@CluelessIdeas

Thanks for the info! I was wondering about the “breaking point” of different devices.
Really helpful. [import]uid: 70847 topic_id: 19701 reply_id: 76202[/import]

Values in the literature for iOS devices & single apps are the following:

installed memory: 128 MB --> memory warning threshold: 20-25 MB

installed memory: 256 MB --> memory warning threshold: 80-90 MB

installed memory: 512 MB --> memory warning threshold: 260-300 MB (estimated)
[import]uid: 67641 topic_id: 19701 reply_id: 76207[/import]

What about memory usage for mobile devices?

*edit I just saw @RAoM_games post. It’s like RAoM_games read my mind. [import]uid: 108842 topic_id: 19701 reply_id: 76209[/import]

@CluelessIdeas

Hi!
I’m experiencing slow downs on the game I’m working on on iPhone 4, using 42MB texture memory. It’s running smoothly on iPhone 3GS and iPad 1 though.
Should I look somewhere else? [import]uid: 25327 topic_id: 19701 reply_id: 80613[/import]

Yes probably there’s something else causing the slowdowns. Are all those devices running the same iOS version? I had a similar problem where a game would run fluidly on iPod 4G but on iPad it would stutter like crazy. Since the hardware is very similar I can only attribute that to different iOS versions, as iPad was running 4.2 and iPod 5.0.

Also, the slowdown may be caused by using many transitions on large bitmaps. You can have a ton of 2048x2048 animation spritesheets with transitions if the frame size is small (eg. 64x64), but if you try to transition 2048x2048 whole images it will be slow. [import]uid: 61899 topic_id: 19701 reply_id: 80616[/import]

Thanks for your quick response.
They’re all running on iOS 5.0.1 so it’s not because of different OS.

I’m not using transitions to move objects as everything is handled by Box2D (except for pop-ups), nor moving huge bitmaps.

Maybe I should just have a deep look at my tilemap engine… [import]uid: 25327 topic_id: 19701 reply_id: 80637[/import]