How does the memorywarning event used?

I have a general question as to how the event memroywarning (iOS) is used:
http://developer.anscamobile.com/reference/index/memorywarning-ios

From what I've found you'll run out of memory on the device but not on the simulator so registering for this event doesn't seem particularly helpful on the simulator. I understand the simulator can't simulate the same memory constraints as the device (based on what other apps are running, etc) so I'm wondering what the scenarios are where this is helpful. Anyone making good use of this and care to explain?

It really depends on your app, but here's a good scenario...

Say you have a lot of objects, sounds, etc. preloaded into memory so you could easily call them up and use them without having to recreate them.

You could listen for the memory warning, and if one comes up, you can free up some of the resources that aren't immediately needed right at that moment to prevent a potential crash.

I see, that makes sense. So this is more of a last ditch effort to possibly prevent a crash on the device. Is there a way to test this with the simulator? What is the memory threshold on the simulator for receiving this event, and is it possible to adjust this threshold manually for testing that code under low memory conditions?

views:1629 update:2011/10/3 8:06:12
corona forums © 2003-2011