Texas Instruments TI89 Developer Guide - Page 135
CM_INSTALL message., When the application receives the unpack
UPC - 033317198566
View all Texas Instruments TI89 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 135 highlights
Chapter 9: Application Control Flow 93 Sometimes an application needs to be moved to another place in Flash memory. This can happen when another application is deleted and the OS garbage collects to free up unused Flash memory. The application receives a CM_PACK command before garbage collect begins then CM_UNPACK after garbage collect ends. The application's static data is reinitialized when this happens, hence the application needs to perform much the same initialization as if it received the CM_INSTALL message. Alternatively, there is a four-byte location (publicstorage) in the application's ACB (Application Control Block) where the app can store a value during CM_PACK processing which can be retrieved during CM_UNPACK processing. If the application has a lot of data to save, it can allocate memory from the heap and store its handle in publicstorage. When the application receives the unpack message, it retrieves the memory handle from publicstorage, reinitializes its data, and releases the handle. Use routines OO_appSetPublicStorage and OO_appGetPublicStorage to save and retrieve your application's publicstorage. Note: An application will never receive pack/unpack messages while it is active. The application will always have been terminated (that is, received the CM_QUIT message) before it is moved. The OS sends CM_UNINSTALL to an application as final notification when it is about to be deleted. Any memory handles the application allocated when it was installed or while it was active should be deleted at this time to prevent memory leaks. TI-89 / TI-92 Plus Developer Guide Not for Distribution Beta Version January 26, 2001