Initial Release 5.0

Function : OS Memory
OSMemoryAllocate - Allocate a block of memory - returns MEMHANDLE
----------------------------------------------------------------------------------------------------------

#include <osmem.h>

STATUS LNPUBLIC OSMemoryAllocate(
DWORD dwtype,
DWORD size,
MEMHANDLE *rethandle);

Description :

It is advisable to use the OSMemoryAllocate function, instead of the OSMemAlloc function, at the places where Domino or Notes takes a pointer to the data, and you choose to use the Domino memory allocator to allocate storage for that data.

This function returns MEMHANDLE which has no relationship with the datatype HANDLE. A HANDLE is a WORD on all platforms except Win32. On Win32, it is a DWORD, but the HANDLE is still restricted to 16 bits of actual usage, which limits an application to 64K HANDLEs. Due to a Domino algorithm change, OSMemoryAllocate returns DWORD MEMHANDLEs which free the constraint posed by the size of the HANDLE datatype.

OSMemoryAllocate allocates a block of memory and returns a MEMHANDLE handle to the caller. The memory should be locked with the function OSMemoryLock, and unlocked and released using the function OSMemoryUnlock and OSMemoryFree respectively.

This function guarantees that if the memory allocation fails, the returned handle will be NULLMEMHANDLE. Unlike OSMemAlloc, this function allocates 0 byte if that is requested, instead of returning a NULLHANDLE with success.


Parameters :

See Also :

MEMHANDLE
----------------------------------------------------------------------------------------------------------