![]() |
![]() |
![]() |
![]() |
MemoryMgr.h.
Err MemCardInfo (UInt16 cardNo, Char* cardNameP, Char* manufNameP, UInt16* versionP, UInt32* crDateP, UInt32* romSizeP, UInt32* ramSizeP, UInt32* freeBytesP)
|   |
|
Card number. |
|   |
|
Pointer to character array (32 bytes), or 0. |
|   |
|
Pointer to character array (32 bytes), or 0. |
|   |
|
Pointer to version variable, or 0. |
|   |
|
Pointer to creation date variable, or 0. |
|   |
|
Pointer to ROM size variable, or 0. |
|   |
|
Pointer to RAM size variable, or 0. |
|   |
|
Pointer to free byte-count variable, or 0. |
NOTE:  Blocks are compared as unsigned bytes.
Int16 MemCmp (const void* s1, const void* s2, Int32 numBytes)
s1 > s2
s1 < s2
MemCmp can be used to test the equality of blocks in memory on all versions that support MemCmp; however, testing the sort ordering of blocks in memory works reliably only on Palm OS® versions 3.5 and higher. On versions earlier than 3.2, MemCmp always returns a positive value if the blocks are unequal. On versions 3.2 and 3.3, MemCmp reliably returns positive to indicate s1 > s2 and negative to indicate s1 < s2 only if the characters that differ are less than 128 apart. If the difference is greater than that, MemCmp may return positive when it should return negative and vice versa.
UInt16 MemDebugMode(void)
UInt16 MemHandleCardNo (MemHandle h)
MemPtrCardNo
true if the given handle is part of a data storage heap. If not, it's a handle in the dynamic heap.
Boolean MemHandleDataStorage (MemHandle h)
true if the handle is part of a data storage heap.
MemPtrDataStorage
Err MemHandleFree (MemHandle h)
MemHandleNew
UInt16 MemHandleHeapID (MemHandle h)
MemPtrHeapID
MemPtr MemHandleLock (MemHandle h)
MemHandleLock and MemHandleUnlock should be used in pairs.
MemHandleNew, MemHandleUnlock
MemHandle MemHandleNew (UInt32 size)
MemHandleNew allocates, you must call MemHandleLock to lock the chunk and get a pointer to it.
MemPtrFree, MemPtrNew, MemHandleFree, MemHandleLock
Err MemHandleResize (MemHandle h, UInt32 newSize)
|   |
0 |
No error. |
|   |
memErrInvalidParam |
Invalid parameter passed. |
|   |
memErrNotEnoughSpace |
Not enough free space in heap to grow chunk. |
|   |
memErrChunkLocked |
Can't grow chunk because it's locked. |
MemHandleResize function tries to resize the chunk only within the same heap, whereas DmResizeRecord will look for space in other data heaps if it can't find enough space in the original heap.
MemHandleNew, MemHandleSize
Err MemHandleSetOwner (MemHandle h, UInt16 owner)
|   |
-> |
Chunk handle. |
|   |
-> |
New owner ID of the chunk. Specify 0 to set the owner to the operating system. |
SysUIAppSwitch or SysAppLaunch, you must call MemPtrSetOwner to grant ownership of the parameter block chunk to the OS (your application is originally set as the owner). If the parameter block structure references any chunks by handle, you also must call MemHandleSetOwner to grant ownership of those blocks to the OS. If you don't change the ownership of these chunks, they will get freed before the application you're launching has a chance to use them.
UInt32 MemHandleSize (MemHandle h)
MemHandleResize
LocalID MemHandleToLocalID (MemHandle h)
MemLocalIDToGlobal, MemLocalIDToLockedPtr
Err MemHandleUnlock (MemHandle h)
MemHandleLock and MemHandleUnlock should be used in pairs.
MemHandleLock
Err MemHeapCheck (UInt16 heapID)
MemDebugMode, MemSetDebugMode
Err MemHeapCompact (UInt16 heapID)
true if the given heap is a dynamic heap.
Boolean MemHeapDynamic (UInt16 heapID)
true if dynamic, false if not.
NOTE:  In Palm OS 3.5, the dynamic heap is sized based on the amount of memory available, and is generally larger than before.
MemNumHeaps, MemHeapID
UInt16 MemHeapFlags (UInt16 heapID)
MemNumHeaps, MemHeapID
Err MemHeapFreeBytes (UInt16 heapID, UInt32* freeP, UInt32* maxP)
|   |
-> |
ID of heap. |
|   |
<-> |
Pointer to a variable of type UInt32 for free bytes. |
|   |
<-> |
Pointer to a variable of type UInt32 for max free chunk size. |
maxP to determine whether enough free space to fulfill your allocation request exists. If not, you may make more space available by calling the MemHeapCompact function. An alternative approach is to just call the MemHeapCompact function as necessary when an error is returned by the MemPtrNew or MemHandleNew functions.
MemHeapSize, MemHeapID, MemHeapCompact
UInt16 MemHeapID (UInt16 cardNo, UInt16 heapIndex)
|   |
-> |
The card number, either 0 or 1. |
|   |
-> |
The heap index, anywhere from 0 to MemNumHeaps - 1. |
MemNumHeaps
Err MemHeapScramble (UInt16 heapID)
MemDebugMode, MemSetDebugMode
UInt32 MemHeapSize (UInt16 heapID)
MemHeapFreeBytes, MemHeapID
LocalIDKind MemLocalIDKind (LocalID local)
MemPtr MemLocalIDToGlobal (LocalID local, UInt16 cardNo)
|   |
-> |
The local ID to convert. |
|   |
-> |
Memory card the chunk resides in. |
MemLocalIDKind, MemLocalIDToLockedPtr
MemPtr MemLocalIDToLockedPtr (LocalID local, UInt16 cardNo)
MemLocalIDToGlobal, MemLocalIDToPtr, MemLocalIDKind, MemPtrToLocalID, MemHandleToLocalID
MemPtr MemLocalIDToPtr (LocalID local, UInt16 cardNo)
MemLocalIDToGlobal, MemLocalIDToLockedPtr
Err MemMove (void* dstP, const void* sP, Int32 numBytes)
|   |
|
Pointer to destination. |
|   |
|
Pointer to source. |
|   |
|
Number of bytes to move. |
UInt16 MemNumCards (void)
UInt16 MemNumHeaps (UInt16 cardNo)
MemNumHeaps.
UInt16 MemNumRAMHeaps (UInt16 cardNo)
MemNumCards
UInt16 MemPtrCardNo (MemPtr p)
MemHandleCardNo
true if the given pointer is part of a data storage heap; if not, it is a pointer in the dynamic heap.
Boolean MemPtrDataStorage (MemPtr p)
true if the chunk is part of a data storage heap.
MemHeapDynamic
Err MemPtrFree (MemPtr p)
UInt16 MemPtrHeapID (MemPtr p)
MemPtr MemPtrNew (UInt32 size)
NOTE:  You cannot allocate a zero-size reference block.
MemHandle MemPtrRecoverHandle (MemPtr p)
Err MemPtrResize (MemPtr p, UInt32 newSize)
MemPtrSize, MemHandleResize
Err MemPtrSetOwner (MemPtr p, UInt16 owner)
|   |
-> |
Pointer to the chunk. |
|   |
-> |
New owner ID of the chunk. Specify 0 to set the owner to the operating system. |
SysUIAppSwitch or SysAppLaunch, you must call MemPtrSetOwner or MemHandleSetOwner to grant ownership of the parameter block chunk, and any other chunks referenced in it, to the OS (your application is originally set as the owner). If you don't change the ownership of the parameter block, it will get freed before the application you're launching has a chance to use it.
UInt32 MemPtrSize (MemPtr p)
LocalID MemPtrToLocalID (MemPtr p)
MemLocalIDToPtr
Err MemPtrUnlock (MemPtr p)
MemHandleLock
Err MemSet (void* dstP, Int32 numBytes, UInt8 value)
|   |
|
Pointer to the destination. |
|   |
|
Number of bytes to set. |
|   |
|
Value to set. |
Err MemSetDebugMode (UInt16 flags)
|) to provide any combination of one, more, or none of the following flags:
memDebugModeCheckOnChange
memDebugModeCheckOnAll
memDebugModeScrambleOnChange
memDebugModeScrambleOnAll
memDebugModeFillFree
memDebugModeAllHeaps
memDebugModeRecordMinDynHeapFree
Err MemStoreInfo (UInt16 cardNo, UInt16 storeNumber, UInt16* versionP, UInt16* flagsP, Char* nameP, UInt32* crDateP, UInt32* bckUpDateP, UInt32* heapListOffsetP, UInt32* initCodeOffset1P, UInt32* initCodeOffset2P, LocalID* databaseDirIDP)
|   |
-> |
Card number, either 0 or 1. |
|   |
-> |
Store number; 0 for ROM, 1 for RAM. |
|   |
<-> |
Pointer to version variable, or 0. |
|   |
<-> |
Pointer to flags variable, or 0. |
|   |
<-> |
Pointer to character array (32 bytes), or 0. |
|   |
<-> |
Pointer to creation date variable, or 0. |
|   |
<-> |
Pointer to backup date variable, or 0. |
|   |
<-> |
Pointer to heapListOffset variable, or 0. |
|   |
<-> |
Pointer to initCodeOffset1 variable, or 0. |
|   |
<-> |
Pointer to initCodeOffset2 variable, or 0. |
|   |
<-> |
Pointer to database directory chunk ID variable, or 0. |
|   | ![]() |
![]() |
![]() |
![]() |
  |