On Aug 30, 2006, at 5:05 PM, Jeff Ishaq wrote:
I saw the same problem. After going back and forth with Palm DTS for
about two weeks, we solved it by placing a DmSyncDatabase() call after
*any* record operation. This didn't seem to impact the performance
too much.
Interesting. Thanks for the info. Of course, that defeats the purpose
of a cache. You might as well not have a cache. But, that would be the
logical solution for a broken cache.
I'm working on other projects now. Maybe in a few week if I have time I
will insert DmSyncDatabase() calls in my DoTest() function below. Even
if it works, I suspect it will be too slow to use in my app as a
workaround. I'm currently shipping my product with the bug, like most
developers are.
// The code below is a reproducible test that demonstrates
// a bug on the Palm TX and possibly other NVFS devices.
// It creates a 5MB database, closes it, opens it, writes
// to it, closes it, and does a reset. After the reset, the
// database disappears on the TX simulators and a real TX.
// The lowest the cache ever gets in DoTest() is 6.2MB
// total free, and 4.7MB max block. You don't have to reset
// within the program - you can comment out SysReset, quit
// to the launcher, use MemInfo to flush the cache, then
// reset, and it's still gone. If you run DoTest twice
// before reset, the database won't disappear. Using more
// records will prevent the database from disappearing.
#define kTheName "testDB1"
#define kTheType 'tttt'
#define kTheCreator 'cccc'
void DoTest()
{
LocalID dbID;
DmOpenRef dbRef;
UInt16 index;
MemHandle h;
char csr[68], pdr[108];
MemPtr *p;
dbID = DmFindDatabase(0, kTheName);
if (!dbID) {
// -------------- Create the database --------------
DmCreateDatabase(0, kTheName, kTheCreator, kTheType, false);
dbID = DmFindDatabase(0, kTheName);
dbRef = DmOpenDatabase(0, dbID, dmModeReadWrite);
for(index=0;index<10003;index++) {
h = DmNewRecord(dbRef, &index, 524);
DmReleaseRecord(dbRef, index, false);
}
DmCloseDatabase(dbRef);
}
// -------------- Write to the database --------------
dbRef = DmOpenDatabase(0, dbID, dmModeReadWrite);
p = (MemPtr*)MemPtrNew(sizeof(MemPtr) * 10003);
for(index=0;index<10003;index++) {
h = DmGetRecord(dbRef, index);
p[index] = MemHandleLock(h);
}
for(index=1;index<=10000;index++) {
DmWrite(p[index], 32, csr, sizeof(csr));
}
DmWrite(p[0], 340, pdr, sizeof(pdr));
for(index=0;index<10003;index++) {
h = MemPtrRecoverHandle(p[index]);
MemHandleUnlock(h);
DmReleaseRecord(dbRef, index, true);
}
DmCloseDatabase(dbRef);
MemPtrFree(p);
SysReset();
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/