Best practice: Using objects judiciously
To allow a BlackBerry® Java Application to efficiently use memory resources, consider the following questions:
- Given the size of an application, are all of the objects necessary?
- Can your application store any objects that represent primitives, such as Long, Integer, and Boolean, as primitives instead of as objects?
- Are all of the persisted objects necessary?
- Do any instances of Vector and Hashtable exist? Are these instances necessary? If so, how many Object handles are not used in the Vector or Hashtable because the initial size is greater than the needed size?
- How many Objects does your application create and then throw away? In other words, how many scope-specific Objects does your application create?