Removing sensitive data
The memory cleaner can delete sensitive data that is stored in memory on a smartphone. Specific events trigger the memory cleaner to clear various caches and perform secure garbage collection. The memory cleaner is not on by default, but is turned on automatically when you enable encryption. To manually turn on the memory cleaner, the device user clicks Options > Security Options > Advanced Security Options > Memory Cleaning and sets the status to Enabled.
The Memory Cleaner API is implemented in the net.rim.device.api.memorycleaner package.
Users can configure which events trigger a memory cleaning. You can register your app to be notified if one of those events occurs. To do so, implement the MemoryCleanerListener interface and register it using one of the static methods MemoryCleanerDaemon.addListener() or MemoryCleanerDaemon.addWeakListener().
The MemoryCleanerListener interface has two methods, cleanNow() and getDescription(). The cleanNow() method is invoked by the memory cleaner when a user-configurable event occurs. The memory cleaner passes an event parameter when it calls cleanNow() to indicate the event that initiated the memory clean request. The getDescription() method is invoked by the memory cleaner if the memory cleaner must display information about apps that are registered cleaners. This functionality is required, for example, on the Memory Cleaning option screen.