3GS+ hardware memory limits

Anyone have any idea on the limits on 3GS+ hardware for games? On 3G it was 26mb-32mb, IIRC, but obviously the 3GS has double the memory and iPhone 4 has 4x the memory.

I’d assume that the limits weren’t just “double”.

I’m having a bit of a crash problem on my latest builds of the game. The issue is that I’m getting no crash reports from XCode (just says “Exited Abnormally with code 0”), so I’m trying to work out what it could be.

Any info much appreicated.

SB

Have you tried using Instruments to double check that it is memory?

On device the the iPod Touch 1G, 2G, iPhone 2G, 3G, all have 128 mb memory. (Call this Group 1)

The iPod Touch 3G, 4G and iPhone 3GS has 256 mb memory. (Group 2)

The iPhone 4 has 512 mb Memory. (Group 3)

All of the devices are Embedded Systems, meaning that the CPU and GPU share the same memory. However Group 1 is unique in that it has a specific amount of Video Memory reserved (24 mb), whereas the other two can free up RAM for VRAM and vice versa.

This makes it difficult to measure the true amount of memory available in Group 3 and Group 4, because it can be mixed between the two. iPhones generally have less free memory for you (they have to have the phone process running), and not all memory is available because much of it is used by Apple itself in handling the OS and any events and processes it needs to run.

On Group 1 devices you can get up to about 40 megs system memory before getting issues without getting any memory warnings.

If you get really close to the memory limit, it will warn you. If you blow past it by a couple megs in one allocation it’ll kick you out with the response you saw.
One Unity related event that I found that can get you in trouble with memory is GetPixels. Unity gives you the data in an array of Colors, which are 4 floats. There are many others as well, but a large Allocation is likely the culprit if it doesn’t warn you. Also if it takes more than 30 seconds to load it’ll kick you out like that as well.

Even if the information is in RGBA32 or ARGB4444, GetPixels() will return something that is 128 bits/pixel, which for a 1024x1024 sheet results in over 33 megs in a single array.

Otherwise I would suggest using Instruments with the Memory Monitor (Not Allocations, that’s unreliable) and see when and where the memory is being used.

Also for Managed memory with scripts you can use GC.GetTotalHeap multiple times and compare to determine (somewhat it’s unreliable especially with Coroutines because other things are being allocated) the size of classes once initialized.

Surely it can’t be the case that for mobile applications, Unity decompresses a 1024x1024 texture into a 33meg array? When I was producing games on the 3G hardware, I used 1 1024x1024 texture and 1 512x512 for each level, and the game only used about 27 meg total?

I realise the architecture of the machines, and know the size of their internal memory. I was really just wondering if anyone had come up against and “hard limits” as there were (essentially) on 3G hardware so I could count that out from my debugging efforts.

The console isn’t reporting any memory warnings either, which is odd, if this is a memory crash…

There are not really hard limits, especially with multi tasking on the newer OS. It depends on what else is currently running on the device.

And the issue with the gargantuan sizes of GetPixels doesn’t have to do with the size on GPU, but that GetPixels returns a structure that is not 16 or 32 bits per pixel, but 128. If you don’t call GetPixels, it doesn’t occur.

If it’s just a straight up crash without warnings look in your code for any large allocations (giant arrays, loading large uncompressed textures, etc…).

Doesn’t sound like a memory-related crash to me. In my experience “exited abnormally with code 0” means a script error, like a null reference or out of array index. How much memory does your app use anyway, did you check yet?