_ALLOCATE - allocate block of storage in parent function.

(GCOS-8 Only)


ptr = _allocate(size,parent);


size_t size;
is the number of bytes of storage to allocate.
int parent;
is a number indicating a parent function. A 1 indicates the parent of the function calling "_allocate". A 2 indicates the parent of the parent, and so on. A 0 indicates the function that calls "_allocate".
void *ptr;
points to the allocated storage.


"_allocate" is similar to the usual "malloc" routine. However, the storage allocated by "_allocate" is automatically freed upon termination of one of the parent functions of the function that calls "_allocate". For example, suppose function A calls function B, and B issues the call


The space allocated by this call will be automatically freed when A (the parent of B) finishes execution.

In some sense then, "_allocate" allocates storage that is "local" to some parent function.

See Also:

expl c lib alloc

expl nsc lib malloc

Copyright © 1996, Thinkage Ltd.