HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Memory Pool 359
Using the Memory Pool
Sample Code
/*===========================================================================*/
void AllocatePageExample()
{
RvStatus retStatus;
/*Defines a memory pool handle.*/
HRPOOL appPool;
/*Defines a memory page handle.*/
HPAGE appPage;
/*Constructs a new memory pool with 10 pages and 20 bytes on each page.*/
appPool = RPOOL_Construct(20, 10, NULL, RV_TRUE, "My application");
if (appPool == NULL)
{
printf("Error constructing memory pool");
}
/*Gets a memory page from the memory pool. appPage is the handle to this page.*/
retStatus = RPOOL_GetPage(appPool, 0, &appPage);
if (retStatus != RV_OK)
{
printf("Error getting page from the memory pool");
}
/*Calls the SIP Lite Stack API function with appPool and appPage as parameters.*/
/*Frees the appPage page.*/
RPOOL_FreePage(appPool, appPage);
/*Destructs the appPool memory pool.*/
RPOOL_Destruct(appPool);
}
/*===================================================================================*/