# EssAlloc

Description

EssAlloc() allocates a block of memory, using the defined memory allocation scheme.

Syntax

    ESS_FUNC_M EssAlloc (hInstance, Size, ppBlock);

ESS_HINST_T | hInstance
ESS_SIZE_T | Size
ESS_PPVOID_T | ppBlock

Parameters

hInstance | Essbase API instance handle.
Size | Size of memory block to allocate.
PpBlock | Address of pointer to receive allocated memory block.

Return Value

Returns a pointer to the allocated memory block in ppBlock.

Notes

- This function allocates memory using the user-supplied memory management function passed to the EssInit() function. If no such functions are supplied, the default memory allocation function (dependent on the platform) will be used.
- Memory allocated using this function should always be reallocated or freed by using the EssRealloc() and EssFree() functions respectively.
- It is generally not advisable to allocate a block of zero size, as the effects of such an allocation are platform- and compiler-dependent.

Access

This function requires no special privileges.

Example

    ESS_FUNC_M ESS_GetAppActive (ESS_HCTX_T hCtx,
              ESS_HINST_T hInst)
    {
       ESS_FUNC_M     sts = ESS_STS_NOERR;
       ESS_STR_T     pDbName;
       ESS_STR_T     pAppName;
       ESS_ACCESS_T  Access;

       if ((sts = EssAlloc (hInst, 80, (ESS_PPVOID_T)&pAppName)) == 0)
       {
          if ((sts = EssAlloc (hInst, 80, (ESS_PPVOID_T)&pDbName)) == 0)
          {
             if ((sts = EssGetActive (hCtx, &pAppName, &pDbName, &Access)) == 0)
             {
                if (pAppName)
                {
                   if (*pAppName)
                      printf ("Current active application is [%s]\r\n",pAppName);
                   else
                      printf ("No active Application is set\r\n");
                   printf ("\r\n");
                }
             }
             EssFree (hInst, pDbName);
          }
          EssFree (hInst, pAppName);
       }
       return (sts);
    }

See Also

EssFree()
EssInit()
EssRealloc()