At 02:02 AM 4/18/2005, you wrote:
> From: Ben Combee <[EMAIL PROTECTED]>

> Try replacing the call to DmQueryRecord with a call to
> DmGetRecord followed by DmReleaseRecord.

I hope that wasn't meant seriously, at least not as a general advice.

To point out just two issues: You cannot use DmGetRecord on read-only
databases, and you cannot use it more than once on the same record.

DmQueryRecord is essentially a read-only fileopen. Obviously, what is
needed is a matching fileclose. Why PalmSource has not introduced such a
(glue) function with the introduction of the NFVS cache eludes me.

Switching to a read-write approach instead is the worst possible
solution.

DmGetRecord doesn't indicate that you're going to modify the record. It only tells the OS to mark the record as busy until you release it. It would be an error to use DmGetRecord and then call DmReleaseRecord with the dirty flag set for a read-only database, but it's not an error to call DmGetRecord in the first place.


It's true that you can't get a record that's marked as busy. If this is a problem, then you might want to wrap your records in a reference-counting class that manages the DmGetRecord/DmReleaseRecord calls.

Note, I mentioned that the sequence DmQueryRecord/MemHandleLock will keep the record in memory until it's unlocked. The DB Cache code won't throw away a locked record. However, the MemHandle you get from DmQueryRecord, when unlocked, might be invalidated if more space is needed in the DB cache.

Future implementations of NVFS will be moving the cache-loading logic so that locking the MemHandle will force a reload if needed, but that code isn't deployed on any devices currently on the market.

-- Ben Combee, Senior Software Engineer, palmOne, 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 Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to