net.rim.device.api.system
Class Memory

java.lang.Object
  extended by net.rim.device.api.system.Memory

public final class Memory
extends Object

Virtual machine memory-management utilities.

Some of the utility methods in this class return a MemoryStats object. You can then use the various methods provided by that object to get detailed information about the device's available storage.


Method Summary
static MemoryStats getCodeStats()
          Returns a statistics object for code modules.
static int getFlashFree()
          Returns the amount of free flash.
static MemoryStats getFlashStats()
          Returns a statistics object for flash memory.
static int getFlashTotal()
          Returns the amount of flash needed.
static int getMemoryNeeded()
          Returns the amount of flash the VM wants to recover.
static MemoryStats getObjectStats()
          Returns a statistics object for object handles.
static MemoryStats getPersistentStats()
          Returns a statistics object for persistent objects in flash.
static MemoryStats getRAMStats()
          Returns a statistics object for RAM.
static MemoryStats getTransientStats()
          Returns a statistics object for transient objects in flash.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Method Detail

getRAMStats

public static MemoryStats getRAMStats()
Returns a statistics object for RAM.

The following table describes the information retrievable from the returned MemoryStats object.

Method invoked... Information retrieved...
MemoryStats.getAllocated() Total amount of RAM allocated by the VM.
MemoryStats.getFree() Amount of free RAM available in the system.
MemoryStats.getObjectCount() Number of Java objects residing in RAM.
MemoryStats.getObjectSize() Total size of all Java objects residing in RAM.

Returns:
RAM statistics.

getFlashStats

public static MemoryStats getFlashStats()
Returns a statistics object for flash memory.

The following table describes the information retrievable from the returned MemoryStats object.

Method invoked... Information retrieved...
MemoryStats.getAllocated() Total amount of flash allocated by the VM.
MemoryStats.getFree() Amount of free flash available in the system.
MemoryStats.getObjectCount() Number of Java objects residing in flash.
MemoryStats.getObjectSize() Total size of all Java objects residing in flash.

Returns:
Flash Memory statistics.

getTransientStats

public static MemoryStats getTransientStats()
Returns a statistics object for transient objects in flash.

The following table describes the information retrievable from the returned MemoryStats object.

Method invoked... Information retrieved...
MemoryStats.getAllocated() Total amount of flash allocated by the VM for transient objects.
MemoryStats.getFree() Amount of free flash available in the system.
MemoryStats.getObjectCount() Number of transient Java objects residing in flash.
MemoryStats.getObjectSize() Total size of all transient Java objects residing in flash. Note: This method is not supported in a demand-paged environment. This only occurs in NAND flash devices. The method will return 0 if invoked in such a case.

Returns:
Statistics about transient objects in flash.

getPersistentStats

public static MemoryStats getPersistentStats()
Returns a statistics object for persistent objects in flash.

The following table describes the information retrievable from the returned MemoryStats object.

Method invoked... Information retrieved...
MemoryStats.getAllocated() Total amount of flash allocated by the VM for persistent objects. Note: This method is not supported in a demand-paged environment. This only occurs in NAND flash devices. The method will return 0 if invoked in such a case.
MemoryStats.getFree() Amount of free flash available in the system.
MemoryStats.getObjectCount() Number of persistent Java objects residing in flash.
MemoryStats.getObjectSize() Total size of all persistent Java objects residing in flash. Note: This method is not supported in a demand-paged environment. This only occurs in NAND flash devices. The method will return 0 if invoked in such a case.

Returns:
Statistics about persistent objects in flash.

getObjectStats

public static MemoryStats getObjectStats()
Returns a statistics object for object handles.

The following table describes the information retrievable from the returned MemoryStats object.

Method invoked... Information retrieved...
MemoryStats.getAllocated() Total number of Java objects.
MemoryStats.getFree() Number of Java objects which can still be instantiated.
MemoryStats.getObjectCount() Maximum number of Java objects which the VM can instantiate.
MemoryStats.getObjectSize() Total size of all Java objects. Note: This method is not supported in a demand-paged environment. This only occurs in NAND flash devices. The method will return 0 if invoked in such a case.

Returns:
Object handle statistics.

getCodeStats

public static MemoryStats getCodeStats()
Returns a statistics object for code modules.

The following table describes the information retrievable from the returned MemoryStats object.

Method invoked... Information retrieved...
MemoryStats.getAllocated() Total amount of flash allocated for code modules and related structures (for example, vtables).
MemoryStats.getFree() Amount of free flash available in the system.
MemoryStats.getObjectCount() Number of java objects which point directly to memory in a code module (for example, constant String).
MemoryStats.getObjectSize() Cannot be calculated; always returns 0.

Returns:
Code modules statistics.

getMemoryNeeded

public static int getMemoryNeeded()
Returns the amount of flash the VM wants to recover.

Returns:
Bytes of flash the VM wants to recover.

getFlashFree

public static int getFlashFree()
Returns the amount of free flash.

Returns:
Bytes of free flash.

getFlashTotal

public static int getFlashTotal()
Returns the amount of flash needed.

Returns:
Bytes of flash needed by the VM.





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