Well this is interesting.  Check out this data:

The environment:  
CW6 on POSEr 3.0a3.  Identical results were obtained using the 3.0 debug and
3.0 release ROM images from Palm's webpage.

The test code:

MemHeapFreeBytes(0, &freeInitial, &max);
CharPtr pTest = (CharPtr) MemPtrNew(x);
MemHeapFreeBytes(0, &freeFinal, &max);
delta = freeInitial - freeFinal;

x <- next value // pseudocode
repeat test code        // pseudocode

The results:
x       delta   excess padding
1       16      15
2       10      8
3       14      11
4       12      8
5       14      9
6       18      12
7       16      9
8       16      8
9       18      9
10      18      8
20      28      8
30      38      8
40      48      8


Can someone explain what's going on here?  Am I doing something silly?  I
see that each chunk has the overhead of its own MemChunkHeaderType (I'm
guessing this takes up 8 bytes, or two DWords).  I also assume DWord
alignment to be considered.  But I can't put a finger on exactly what's
going on, especially with x=1, 3, and 6.

This is so much fun!
-Jeff

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to