Memory bounds checking in COBOL programs is easily performed by compiling with the -Za option. See Memory Access Violations and the entry for -Za in Miscellaneous Options for more information.
A second method can be helpful when the problem may be in a linked C routine.
There is a simple method of testing allocated memory bounds errors in any Acucorp product. On Windows systems, the method is turned on and off with a registry entry. On other systems, the method is turned on and off with an environment variable. When an array bounds error is detected, a message is written to the file dbgmalloc.log in the current working directory.
To enable memory bounds checking on Windows, you must create a registry value Test Allocated Memory Bounds in the HKEY_CURRENT_USER\Software\MicroFocus hive, with a type of DWORD and a value of non-zero. To turn memory bounds checking off, you must set the value to zero.
To enable memory bounds checking on UNIX, Linux, and other non-Windows platforms, you must set an environment variable named TEST_ALLOCATED_MEMORY_BOUNDS to a non-zero value. To turn memory bounds checking off, removed the environment variable or set its value to zero.
When memory bounds checking is enabled, messages are printed whenever the memory checking routines detect that allocated memory bounds have been overwritten.