EssRealloc
Description
EssRealloc() reallocates a previously-allocated block of
memory to a different size, using the defined memory allocation
scheme.
Syntax
ESS_FUNC_M EssRealloc (hInstance, Size, ppBlock);
ESS_HINST_T | hInstance |
ESS_SIZE_T | Size |
ESS_PPVOID_T | ppBlock |
Parameters
hInstance | Essbase API instance handle.
|
Size | New size of memory block to reallocate.
|
ppBlock | Address of pointer to previously allocated memory block, to be updated to point to reallocated memory block.
|
Return Value
If successful, returns a pointer to the reallocated memory block
in ppBlock.
Notes
- This function reallocates previously-allocated memory using
the user-supplied memory management function passed to the EssInit()
function. If no such functions are supplied, the default memory
reallocation function (dependent on the platform) will be used.
- Only memory allocated with the EssAlloc() function
should be reallocated using this call. Also, memory reallocated
using this function should always be freed by using the EssFree()
function.
- It is generally not advisable to reallocate a block of zero
size, as the effects of such a reallocation are platform- and
compiler-dependent.
Access
This function requires no special privileges.
Example
ESS_VOID_T
ESS_Realloc (ESS_HINST_T hInst)
{
ESS_FUNC_M sts = ESS_STS_NOERR;
ESS_SIZE_T Size;
ESS_PVOID_T pBlock = NULL;
/* Allocate memory */
Size = 10;
sts = EssAlloc(hInst, Size, &pBlock);
if(sts)
printf("Cannot allocate memory\r\n");
/* Reallocate memory */
Size = 20;
if(!sts)
{
sts = EssRealloc(hInst, Size, &pBlock);
if(sts)
printf("Cannot reallocate memory\r\n");
}
if(pBlock)
EssFree(hInst, pBlock);
}
See Also
EssAlloc()
EssFree()
EssInit()