Previous Topic Next topic Print topic


CBL_ALLOC_SHMEM

Dynamically allocates shared memory.

Syntax:

call "CBL_ALLOC_SHMEM" using     mem-pointer
                       by value  mem-size
                       returning status-code

Parameters:

  Using call prototype (see Key) Picture
mem-pointer cblt-pointer usage pointer. Must be level 01.
mem-size cblt-os-size pic x(4) comp-5

or

pic x(8) comp-5 (64-bit native programs only)

status-code See Library Routines - Key  

On Entry:

mem-size
The number of bytes of memory to allocate.

On Exit:

mem-pointer
A pointer to the memory allocated. The allocated memory is not initialized.
status-code
0 Successful allocation
157 Unable to allocate memory

Comments:

The memory allocated is not initialized to any value.

Updates to any shared memory allocated to this function are not serialized or protected by the run-time system; you should use semaphores to maintain the integrity of the data.

The maximum size of shared memory is restricted by the operating system and the run-time system. The run-time tunable, shared_memory_segment_size, can be used to set the maximum size. The size for shared memory allocated using this routine is limited to a maximum of around 64000 bytes.

Previous Topic Next topic Print topic