Hi Jan,

My test databases have 10000 to 20000 records. My program "gets" every
record and locks it

That does not say much,

There's not much to say.

but I hope that you are aware of DbCache limits,
i.e. how much space is available for all accessed DBs.
Also, for the newest models locking only is not enough - DB protecting is
needed as well.

I wasn't aware I was supposed to do DB protecting. Isn't that only for background apps and callbacks? I'm not doing that. Anyway, using DmDatabaseProtect didn't help.

As far as the dbCache size, I check for errors. What else can I do? What limit should I set? It works fine until the reset. And, larger databases (or smaller) don't disappear. And, flushing the cache doesn't help.

For now, I'm just telling my customers that it's a bug in Palm OS.

I rather suspect violating the NVFS limits and rules.

I wish that were true. Below is an example that 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 (release & debug) and the real device. The debug simulator reports no errors. My version is fully loaded with asserts, and every pointer is valid and nothing returns an error. You don't have to create and write in the same run. And, you don't have to reset within the program - you can quit and reset later.

Do you see anything wrong with it?

Terry



#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/

Reply via email to