JCL Help:GuardAllocMem

From Project JEDI Wiki
Jump to navigationJump to search


Allocates a specified amount of memory and associates it with a safeguard.


 function GuardAllocMem(Size: Cardinal; out SafeGuard: ISafeGuard): Pointer;


Parameters Description
Size: Cardinal Size, in bytes, of the memory to allocate. This memory is allocated using the standard AllocMem function and as such is initialized to all zeros.
out SafeGuard: ISafeGuard Receives a pointer to the ISafeGuard interface which is associated with the allocated memory.

Return Value

Pointer to the block of allocated memory.


GuardGetMem allocates the specified amount of memory and associates it with a safeguard. This function is identical to GuardGetMem except that the function uses AllocMem internally, as opposed to GetMem. As such the allocated memory is initialized with all zeros. A pointer to the allocated memory is returned as the function result. By using GuardGetMem you ensure that no matter how the scope in which the memory is allocated is left (e.g. by an exception or explicit Exit), the memory will be freed. See Guard for a more detailed description.

See Also

Guard GuardGetMem ISafeGuard





Rudy Velthuis

Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page