Object Deletion Mechanism

The object deletion mechanism on the Java Card Platform, Version 3.1 reclaims memory that is being used by "unreachable" objects. Objects become unreachable for a number of reasons such as static or instance fields having missing pointers, missing variable references (not only fields), or when the object is orphaned in an island of isolation. An applet object is reachable until it is successfully deleted.

The object deletion mechanism is not like garbage collection in standard Java technology applications due to space and time constraints. The amount of available RAM on the card is limited. In addition, because the object deletion mechanism is applied to objects stored in persistent memory, it must be used sparingly. EEPROM writes are very time-consuming operations and only a limited number of writes can be performed on a card.

Due to these limitations, the object deletion mechanism in Java Card technology is not automatic: it is performed only when an applet requests it. Use the object deletion mechanism sparingly and only when other Java Card technology-based facilities are cumbersome or inadequate.