Previous Topic Next topic Print topic


M$ALLOC (Dynamic Memory Routine)

Allocates a new area of dynamic memory.
Note: This ACUCOBOL-GT library routine is available in this COBOL version. Any compatibility issues in this COBOL system are in the Compatibility Issues section at the end of the topic.

Usage

CALL "M$ALLOC" 
    USING ITEM-SIZE, MEM-ADDRESS

Parameters

ITEM-SIZE Numeric parameter This indicates the number of bytes to allocate. This must be greater than zero.
MEM-ADDRESS USAGE POINTER This holds the return value, either the address of the allocated memory or NULL if the allocation fails.

Comments

The maximum amount of memory you may allocate in one call depends on the host machine, but is at least 65260 bytes for all machines (providing that much memory is available). M$ALLOC adds some overhead to each memory block allocated. This ranges between 4 and 16 bytes depending on the machine architecture. Also, each operating system will typically add its own overhead. The debugger's U command reports the amount of memory you have currently allocated via M$ALLOC. The overhead added by M$ALLOC is included in the total shown, but the operating system's overhead is not. Memory allocated by M$ALLOC is initialized to binary zeros (LOW VALUES).

If you try to allocate more memory than the environment can give you, M$ALLOC will return NULL, and no memory will be allocated.

Compatibility Issues

None.

Previous Topic Next topic Print topic