At 4:05 PM +0100 9-01-00, Gaurav Palvia wrote:
>Dynamic heap contain a master pointer table.is it same with the
>Storage heap ?

Yes.  Eventually (when Knowledge Base comes back online) see
http://oasis.palm.com/devzone/knowledgebasearticle.cfm?article_id=1145


>when we access a record we get a handle.handle is calculated by adding the
>base address of the card to the LocalId .Am i correct.

Yes, but you should not have to care about such things, except maybe if you
are debugging the memory manager.  Just use the memory manager API.

A handle (MemHandle in 3.5) is an encoded pointer to the 4 byte address.
The encoding is very simple.

A LocalID is an encoded card-relative version of the handle.  The encoding
here is also very simple.

We encode LocalIDs and MemHandles to prevent a programmer accidently using
them as a pointer.  They're encoded such that trying to dereference one
directly will result in an address error.


>if so we dont reqire a Master Pointer Table in the Storege heap.

Your reasoning is not correct.  A handle is just 4 bytes that holds the
address of the real data.  So it has to exist somewhere!  The master
pointer table is the collection of the 4 bytes addresses for all the
moveable chunks in any heap.  (The ROM heap is special, but that's OK,
because it has no moveable chunks!)

Perhaps you're confused because you think the chunks in the storage heap
are not moveable?  That is not the case.  You still have to call
MemHandleLock/MemHandleUnlock on resources and records.  If you don't, they
can move.  They generally only move if you resize them or if the storage
heap is compacted, and the storage heap is not compacter very often (unless
the device is very full or unless you reset a lot.)

                                --Bob



Reply via email to