Manual Reference Pages - RDSALLOC (3)
[Include document man1/alc_contents.mac]
rdsalloc - memory allocation function
[Include document man1/alc_origin.1]
char *rdsalloc( Size, Heap )
unsigned int Size;
memory size to allocate
takes the values RDS_ALLOC_BLOCK or RDS_ALLOC_HEAP (two defined constants).
The rdsalloc function can do memory allocation by block or by heap. If the user wants to allocate by block, he sets the parameter Heap to the constant RDS_ALLOC_BLOCK else, he wants to allocate by heap so the parameter Heap is set to RDS_ALLOC_HEAP.
If rdsalloc is used with the constant RDS_ALLOC_BLOCK then rdsalloc is used as standard language C function malloc().
If the user allocates by heap then :
At the first allocation of the block of size the parameter 'Size', a heap of size multiple of the block Size is allocated. When another allocation of the same size is done then if the the heap isnt full then a pointer (of size='Size') is returned else a new heap is allocated and a pointer returned. Like this, the user does really one allocation (he has many pointers) to minimize fragmentation. Heap allocation is usefull if the user has to allocate many pointers of the same size (ex: rdsrec_list structure).
Note: Memory place allocated is set to NULL.
pointer to the allocated memory is returned.
"Rds202: rdsalloc error, cant continue !"
its impossible to allocate the memory size desired.
(rdsrec_list *) rdsalloc (sizeof(rdsrec_list *),RDS_ALLOC_HEAP);
(rdsfig_list *) rdsalloc (sizeof(rdsfig_list *),RDS_ALLOC_BLOCK);
[Include document man1/alc_bug_report.1]
|ASIM/LIP6 ||RDSALLOC (3) ||October 1, 1997 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.