net.rim.device.api.lowmemory
Interface LowMemoryListener


public interface LowMemoryListener

Listener interface for receiving and reacting to low memory events.

Note: It is important that implementors of this interface implement LowMemoryListener.freeStaleObject(int) properly. It should only return true if it actually frees up an object of some kind.

See Also:
LowMemoryFailedListener, LowMemoryManager
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Field Summary
Category: Signed static int HIGH_PRIORITY
          High priority low-memory requests.
Category: Signed static int LOW_PRIORITY
          Low priority low-memory requests.
Category: Signed static int MEDIUM_PRIORITY
          Medium priority low-memory requests.
 
Method Summary
Category: Signed  boolean freeStaleObject(int priority)
          Called when the amount of available flash on the device has dropped below a safe level.
 



Field Detail

LOW_PRIORITY

static final int LOW_PRIORITY
Low priority low-memory requests.

In response to requests at LOW_PRIORITY, the listener should only free non-critical objects such as cached data.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

MEDIUM_PRIORITY

static final int MEDIUM_PRIORITY
Medium priority low-memory requests.

In response to requests at MEDIUM_PRIORITY, the listener should free objects that are stale, such as very old unfiled messages or old calendar entries.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

HIGH_PRIORITY

static final int HIGH_PRIORITY
High priority low-memory requests.

In response to requests at HIGH_PRIORITY, the listener should free any objects that it considers to be stale in an effort to meet the memory requirements.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0


Method Detail

freeStaleObject

boolean freeStaleObject(int priority)
Called when the amount of available flash on the device has dropped below a safe level.

In response to this call, the listener should attempt to free one stale persistent object, and call LowMemoryManager.markAsRecoverable(Object o) to indicate to the VM the amount of flash freed. Note that this is an "opt-in" system, and therefore it is not guaranteed that a call to this method will result in any flash memory being freed.

Parameters:
priority - The priority level of the request. Listeners should use this parameter to determine what types of objects should be freed. See the priority level descriptions in this class for details.
Returns:
True if some persistent object was released, which indicates that the LowMemoryManager should feel free to call this method again to free more data if necessary. Otherwise false, which indicates that no memory was freed and that the LowMemoryManager should not call this method again until an emergency garbage collection occurs.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal