Prevent a memory leak when implementing an ApplicationMenuItem

by Retired ‎02-12-2010 04:13 PM - edited ‎02-17-2010 10:03 AM (1,945 Views)


This article applies to the following:

  • BlackBerry® smartphones based on Java® technology


When implementing an ApplicationMenuItem, it is possible to create a memory leak. The memory leak occurs when a reference to an application’s process (i.e., UiApplication) is stored in the ApplicationMenuItem. Storing a reference to an application process in an object that is registered with the system (e.g., an ApplicationMenuItem) causes the application to never be shut down completely.

To avoid this, do not store a reference to UiApplication in an ApplicationMenuItem.