Memory

void Free(
    void * pvMemory)


Accepts a pointer to memory previously allocated with Malloc() and deallocates it. The memory is then free to be allocated again at a later time. If NULL is passed, the function returns without further processing. Allocated memory should always be freed by the script when the script is done with it, except in the case where the script returns a pointer to allocated memory to the system.


void * Malloc(
    unsigned long ulCount)


Allocate ulCount bytes of memory. If the requested memory can not be allocated, NULL is returned. Memory allocated with this function should be freed with Free() when the memory is done being used, however failure to do so will not result in a memory leak. If the system calls a script function and that function returns a pointer to memory allocated with this function, that memory should not be released by the script or the system will be unable to access the value at that location. The memory will be released by the system after the script has executed and the system has used the data returned by the script.


int MemCmp(
    void * pvBuf1,
    void * pvBuf2,
    unsigned long ulCount)


Compares the first ulCount bytes of pvBuf1 and pvBuf2 and returns a value indicating their relationship.


void * MemCpy(
    void * pvDest,
    const void * pvSource,
    unsigned long ulCount)


Copies ulCount bytes from pvSource to pvDest.


void * MemMove(
    void * pvDest,
    const void * pvSource,
    unsigned long ulCount)


Copies ulCount bytes from pvSource to pvDest. If some regions of the source area and the destination overlap, the function ensures that the original source bytes in the overlapping region are copied before being overwritten.


void * MemSet(
    void * pvDest,
    char cValue,
    unsigned long ulCount)


Sets the first ulCount characters of pvDest to the character cValue.


void * ReAlloc(
    void * pvOrig,
    unsigned long ulCount)


Accepts a pointer to memory previously allocated with Malloc() and the new size of the allocation. Returns a pointer to the new allocation or NULL on failure. If the return pointer is different from the original pointer, the memory previously stored at pvOrig is copied to the new location. If pvOrig is NULL, the function behaves exactly like Malloc() and allocates the requested number of bytes.


int WMemCmp(
    short * pwBuf1,
    short * pwBuf2,
    unsigned long ulCount)


Compares the first ulCount 16-bit Unicode characters of pwBuf1 and pwBuf2 and returns a value indicating their relationship.


short * WMemCpy(
    short * pwDest,
    const short * pwSource,
    unsigned long ulCount)


Copies ulCount 16-bit Unicode characters from pwSource to pwDest.


short * WMemMove(
    short * pwDest,
    const short * pwSource,
    unsigned long ulCount)


Copies ulCount Unicode characters from pwSource to pwDest. If some regions of the source area and the destination overlap, the function ensures that the original source bytes in the overlapping region are copied before being overwritten.


short * WMemSet(
    short * pwDest,
    short wValue,
    unsigned long ulCount)


Sets the first ulCount Unicode characters of pwDest to the character wValue.


Copyright © 2006 Shawn (L. Spiro) Wilcoxen