Maybe we've been lucky.

The NearSpace client application is a viewer for read-only databases. It's normally a separate record database that's viewed, but it can be a resource database, and can be itself, the executing program. We've never had a "chunk underlocked" problem.

The system calls involved in an execution where the application reads from itself are basically these:

1) DmOpenDatabase(), after which both the system and the executing application have DmOpenRefs to the database. Mode is dmModeReadOnly.

2) A few calls to DmNumResources() and DmResourceInfo(), hopefully not relevant to the current discussion.

3) N successive calls MemHandleLock(DmGetResourceIndex(...)) for the last N (typically 10-20) resources in the database.

4) Interact with the user for a long time, accessing database contents only through the memory pointers acquired in step 3.

5) On each of those N pointers to resource data, do:

            MemHandle h = MemPtrRecoverHandle(rsrcPtr);
            MemPtrUnlock(rsrcPtr);
            DmReleaseResource(h);

6) DmCloseDatabase().



Greg Lutz
NearSpace, Inc.



[...]

> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Behalf Of Jeff
> > Diamond
> > Sent: Tuesday, March 25, 2003 12:01 PM
> > To: Palm Developer Forum
> > Subject: Opening the current App database causing crash on exit..
> >
> >
> > I have a program that reads data from a PRC database.  It works fine
> > when that PRC database is external to itself.
> > But when I try to open and read from my current (running) PRC,
> > everything works fine until I exit.  I then get a fatal memory manager
> > error saying only "Chunk Underlocked, but with no additional info".
> >
> > In debugging this with the debug console, it appears that my App has
> > fully exited by this point, and the error is in the system.
> > Interestingly enough, it MAKES NO DIFFERENCE in my app if I choose to
> > not close the database at all before exiting, or even if I close
it twice!
> >
> > I assume there is some logical issue with the fact that I've opened my
> > App for reading, and so has the OS.
> > Is there a way to make this work?
> >
> > Thoughts much appreciated!
> > - Jeff Diamond




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

Reply via email to