memoryWarning *iOS only*
The iOS low memory warning is exposed as a Corona event type named "memoryWarning", sent to the global Runtime object. This event has no fields.
When this event fires, the OS reserves the right to forcibly shut down the application in about five seconds (although it may or may not do so). Apple advises developers to listen for this warning, and to handle it by freeing as much memory as possible when it is received.
Runtime:addEventListener("memoryWarning", listenerFunction )
Here is an example of a listener for this event:
local function handleLowMemory( event ) print( "memory warning received!" ) end Runtime:addEventListener( "memoryWarning", handleLowMemory )
An event listener function to be notified when a low memory situation occurs.
You can monitor texture memory used by calling
display.getInfo("textureMemoryUsed" ). This returns the texture memory usage (in bytes). Texture memory (for graphics/images) tends to be the most sharply limited resource in mobile development, since it runs out before normal memory.
Supported on operating systems and platforms for build numbers shown:
- Mac OS X:--
- iOS:Corona SDK 2.0
- API tags: