I am using MemHeapFreeBytes() to figure out how much free space is left on
the heap (duh).  However, the results I get don't seem correct.  For
example, on an OS 4.0 debug ROM, MemHeapFreeBytes() tells me the max chunk
size is more than 200K!  Obviously I cannot allocate something that large.
An OS 3.5 debug ROM gives me about 100K, and an OS 3.0 debug rom tells me
the max chunk size is 65,428.  I guess that might be correct since it's
(BARELY!) under the 64K limit but I'm skeptical nonetheless.

Here is how I'm using MemHeapFreeBytes()...

---------------------------------------------
UInt16 i = 0;
UInt32 maxChunkSize = 0;
UInt32 heapFreeSpace = 0;
UInt32 thisChunkSize = 0;
UInt16 heapID = 0;
UInt16 cardNo = 0;

for (i=0; i<MemNumRAMHeaps(cardNo); i++) {
  heapID = MemHeapID (cardNo, i);

  if (MemHeapDynamic(heapID)) {
    MemHeapFreeBytes (heapID, &heapFreeSpace, &thisChunkSize);
    if (thisChunkSize > maxChunkSize)
      maxChunkSize = thisChunkSize;
  }
}

return maxChunkSize;
----------------------------------------------

I've also tried this under various SDK's without any change.

Am I missing something?  Anybody else seen this behavior?  Thanks for any
and all suggestions.

Nick Guarracino
DataViz, 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