FusePowered

memoryWarning *iOS only*

Description:

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.

Syntax:

Runtime:addEventListener("memoryWarning", listenerFunction )

Example:

Here is an example of a listener for this event:

local function handleLowMemory( event )
    print( "memory warning received!" )
end
 
Runtime:addEventListener( "memoryWarning", handleLowMemory )

Parameters:

listenerFunction
An event listener function to be notified when a low memory situation occurs.

Returns:

Nothing.

Remarks:

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:
    --
  • Windows:
    --
  • iOS:
    Corona SDK 2.0
  • Android:
    --

Replies

quadworks
User offline. Last seen 14 weeks 5 days ago. Offline
Joined: 25 Oct 2010

Hi there,
in the Remarks-section, shouldn't display.getInfo("textureMemoryUsed") not be system.getInfo("textureMemoryUsed")?
Jörg