>"When this call changes appInfoID or sortInfoID, the old chunkID (if any) is
>marked as an orphan chunk and the new chunk ID is unorphaned. Consequently,
>you shouldn't replace an existing appInfoID or sortInfoID if that chunk has
>already been attached to another database."
>
>The reference doc and the companion doc do not say what an orphaned chunk
>is. I assume that once a chunk is orphaned like this applications programmer
>(me) does not need to do anything more about it?
Quite the contrary. An orphaned chunk is something that has been allocated
in the storage heap, but which nothing refers to. It is therefore at risk
of getting lost and causing a memory leak. (No offense intended to you in
any of this, of course...) As the documentation says, it is marked as
being an orphan, but that doesn't change the fact that it isn't attached to
anything.
The problem with an orphaned chunk is that unless it is put into a database
as a record or appInfo block or so forth, it could get lost if the
application doesn't keep track of it in a global variable or something. If
the application doesn't get around to freeing the chunk before it quits (or
crashes or is reset), then that'll be storage that will be forever unusable
- the user can't delete it since the user only deletes databases, and yet
it uses precious space.
There is a safety mechanism built in to the OS: during a soft reset, the OS
walks through the storage heap and finds orphaned chunks and frees them.
(By definition, during reset, no apps know about that orphan and thus it is
truly lost.) But since most users reset only rarely, you don't want to
rely on this happening.
So it is called an orphan because nobody is in charge of it and thus can
get lost and be a loss to "society". Well, the app is hopefully in charge
of it and will put it in a database soon... the reason orphans are
sometimes appropriate is when you're moving something from one database to
another, or replacing one appInfo block with another (and then presumably
deleting the old one.)
-David Fedor
Palm, Inc.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/