>Richard -
>
><<<
>itemList[year] = (char *) MemPtrNew(6);  // just enough for a year
>string
>>>>
>
>Why are 6 bytes reserved?  4 for the date (e.g. 2001) and 1 for the
>terminating "0".

Oh, I dunno, I just wanted to be Y10K compliant... I wasn't expecting that
people would allocate memory this way in reality; it wasn't really the
point of the example.  Besides, that one extra byte would have gotten
allocated anyway and just wasted in the slop, since the memory manager
takes things in chunks of 4 or 8 bytes, I forget which.

Presumably you'd allocate memory in a more intelligent way than having a
separate chunk for each item, unless you really needed to do so.  There's
more overhead in these allocations than actual usable data.

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

Reply via email to