The following obtuse comment from another developer seems to confirm my
vague suspsicions but did not provide details, references, documentation or
work-around:

   "New NVFS from garnet 5.4.9 can remove any resouce (locked or unlocked)
   from closed unprotected database."

What this means: this sequence of code that was always broken now really doesn't work:

DmOpenDatabase
DmGetResource
ptr = DmLockHandle
...
DmCloseDatabase
use ptr

You can only keep handles from databases as long as they are opened or protected. This code would work if you added

DmOpenDatabase
DmProtectDatabase
DmGetResource
ptr = DmLockHandle
...
DmCloseDatabase
use ptr

This is because, starting with Palm OS 5.4.9, the NVFS implementation works at the record level. The memory manager should keep a record active in the DB cache if

1) it's locked, and
2) it belongs to a database that's open or protected

If you unlock a handle, the data can be purged, but it will be reloaded from the file store if the handle is relocked. However, handles will be invalidated when their associated DB is closed -- unless you protect the DB first.

-- Ben Combee, Senior Software Engineer, Palm, Inc.
   "Combee on Palm OS" weblog: http://palmos.combee.net/
   Developer Forum Archives:   http://news.palmos.com/read/all_forums/


--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to