CBL_MEM_STRATEGY

Changes the memory strategy for an application dynamically.

Note: This routine is supported for native COBOL only.

Syntax:

call "CBL_MEM_STRATEGY" using by value     func
                              by reference flags
                              returning    status-code

Parameters:

  Using call prototype (see Key) Picture (32-bit systems)
func cblt-x4-comp-5 pic x(4) comp-5.
flags cblt-x4-comp-5 pic x(4) comp-5.
status-code See Library Routines - Key

On Entry:

func
0 Get memory strategy
1 Set memory strategy
2 Get number of freed memory blocks being checked
3 Set number of freed memory blocks to be checked
flags
If func is set to 1, flags indicates the memory strategy to set, as follows:
Bit 0
0 No action
1 Check bytes strategy: prepend and append check bytes to each memory allocation
Bit 1
0 No action
1 Check freed memory strategy: monitor for subsequent corruption the last n memory blocks freed, where n is the current value as set when func is set to 3
Bit 2
0 No action
1 Reuse strategy: allow freed memory being monitored for corruption to be used to satisfy allocation requests
Bits 3-29
Reserved for future use. Must be set to zero.
Bit 30
0 No action
1 Compatibility strategy: maintain compatibility with previous versions of the run-time system
Bit 31
0 No action
1 Validate strategy: validate memory each time an allocation or free operation occurs
If func is set to 3, flags indicates the number of freed memory blocks to be monitored for corruption.

On Exit:

flags
If func is set to 0, flags indicates the current memory strategy,as follows:
Bit 0
0 No action
1 Check bytes strategy: prepend and append check bytes to each memory allocation
Bit 1
0 No action
1 Check freed memory strategy: monitor for subsequent corruption the last n memory blocks freed, where n is the current value as set when func is set to 3
Bit 2
0 No action
1 Reuse strategy: allow freed memory being monitored for corruption to be used to satisfy allocation requests
Bits 3-29
Reserved for future use. Set to zero.
Bit 30
0 No action
1 Compatibility strategy: maintain compatibility with previous versions of of the run-time system
Bit 31
0 No action
1 Validate strategy: validate memory each time an allocation or free operation occurs
If func is set to 2, flags indicates the number of freed memory blocks being monitored for corruption.
status-code
Status of operation:
0 All memory allocations are intact
1000 Insufficient memory to perform request
1009 Invalid parameter specified

Comments:

Use this routine to change the memory strategy for an application from within the application. It provides the same functionality as that provided by the memory_strategy and memory_free_check_size run-time tunables.