Chapter Contents

Previous

Next
hpattr

hpattr



Initialize _heap_attr Structure


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <multheap.h>
void hpattr(_heap_attr _ _near *attr);


DESCRIPTION

hpattr initializes a _heap_attr structure. After initialization, members of the structure should be set to indicate qualities of the heap to be created. By default, the version, subpool and overflow members are set to default values. At Version 1, the subpool default is 13 and the overflow size is 4K. See _heap_attr for more information on the flags and fields of the _heap_attr structure.


RETURN VALUE

hpattr does not return a value.


EXAMPLE

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <multheap.h>
_heap_attr attr;
main()
{
   _heap_id id1, id2;
   
// create a user heap

   hpattr(&attr);
   attr.amode = HPLOC_BELOW;                          
   attr.subpool = 14;                                 
   attr.flags = HPATTR_SIGOK + HPATTR_NOABEND;        
   attr.initial = 1000;                               
   id1 = hpcreate(&attr, "first");                     
   if (!id1)                                          
   {                                                   
      WTP("error in hpcreate.\n");                    
      return -1;                                      
   }                                                  
   WTP("id1 = %04hX\n", id1); 
 
// create second heap with slightly different
// parms. 
                        
   attr.amode = HPLOC_ANY;                          
   attr.subpool = 15;                                 
   attr.initial = 3000;                               
   id2 = hpcreate(&attr, "second");                     
   if (!id2)                                          
   {                                                   
      WTP("error in hpcreate.\n");                    
      return -1;                                      
   }                                                  
   WTP("id2 = %04hX\n", id2);                         
}


RELATED FUNCTIONS

hpcreate


SEE ALSO

"Memory Allocation Functions" in Chapter 2, "Function Categories" of the SAS/C Library Reference, Volume 1.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.