JCL Help:GuardGetMem

From Project JEDI Wiki
Jump to navigationJump to search


Summary

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


Pascal

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


Parameters

Parameters Description
Size: Cardinal Size, in bytes, of the memory to allocate. This memory is allocated using the standard GetMem function and as such is uninitialized.
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.


Description

GuardGetMem allocates the specified amount of memory and associates it with a safeguard. 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 GuardAllocMem ISafeGuard


About

Unit

JclSysUtils


Donator

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