Miken wrote:
I get the available Storage/dynamic memory using the following code:

nCards = MemNumCards();
for (cardNo = 0; cardNo < nCards; cardNo++)
{
  for (i=0; i < MemNumRAMHeaps(cardNo); i++)
  {
      heapID = MemHeapID(cardNo, i);
      if (MemHeapDynamic(heapID))
      {
         MemHeapFreeBytes(heapID, &heapFree, &max);
         dynamicMemory += heapFree;
      }
      else
      {
         MemHeapFreeBytes(heapID, &heapFree, &max);
         StorageMemory += heapFree;
      }
  }
}

if dynamicMemory = 60K,Can I call MemPtrNew(60*1024)?
How do palmos handle fragment?

No; you can only do that if there is 60K available in a single, contiguous region, which might be true in your case, but might not be. The simplest way to find out whether you have enough memory for an allocation is to just do it; if the allocation fails, you'll get NULL.

--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to