Saving memory by using dynamic arrays
The language supports both static arrays and dynamic
arrays. For compatibility reasons, static arrays must be allocated in their entirety. This
can result in huge memory usage when big structures are declared, such
as:
DEFINE arr_cust ARRAY[5000] OF RECORD
id INTEGER,
name CHAR(50),
address CHAR(200),
comment CHAR(2000)
END RECORD
If possible, replace such static arrays with dynamic arrays:
DEFINE arr_cust DYNAMIC ARRAY OF RECORD
id INTEGER,
name CHAR(50),
address CHAR(200),
comment CHAR(2000)
END RECORD
However, be aware that dynamic arrays have a slightly different behavior than static arrays.