Enhancement OE00115915 / PSC00161855 was implemented in
Progress 9.1E03, OpenEdge 10.1A, 10.0B04, where the initial shared memory for database Storage Areas was increased in order
not to rely on excess shared memory.
However, in all versions,
if the database contains mandatory fields the amount of extra shared memory that should be specified when the database is started must be calculated. If enough excess shared memory is allocated up front, the database will not crash. The approximate memory requirements when using mandatory fields is as follows:
- 480 bytes overhead
- 48 bytes for each table that contains mandatory field(s)
- 8 bytes for each mandatory field
These numbers are approximations and have been rounded up to account for the 32 bit and 64 bit datatype sizing differences. In addition, the sizes may change from release to release. The total number of bytes calculated must be added to the existing default -Mxs.
Use the following ABL program to determine the number of mandatory fields and the amount to increase -Mxs. This program will:
- Calculate the amount of shared memory that should be reserved based on the number of mandatory fields in the database.
- The total memory required takes into account a database that is started with a -n (number of users) of 100 or less. If more than 100 users are required, the numusers program variable should be initialized appropriately. For further information on how the database broker calculates the default value for -Mxs parameter refer to Article What does the 6495 'Out of free shared memory' error mean?
DEFINE VAR mem AS INTEGER INIT 0 NO-UNDO.
DEFINE VARIABLE man-file-count AS INTEGER INIT 0 NO-UNDO.
DEFINE VARIABLE man-field-count AS INTEGER INIT 0 NO-UNDO.
DEFINE VARIABLE mxs100 AS INTEGER NO-UNDO.
mxs100 = (16 * 1024) + (100 * 400).
mem = 480.
/*
Process each mandatory field in the _field table. When _file-recid
changes, add in the memory requirements for an additional table. Add
the memory requirements for each field.
*/
FOR EACH _field where _mandatory = yes BREAK BY _file-recid.
IF FIRST-OF(_file-recid) THEN DO.
mem = mem + 48.
man-file-count = man-file-count + 1.
END.
man-field-count = man-field-count + 1.
mem = mem + 8.
END.
DISPLAY "Mandatory tables" man-file-count WITH NO-LABELS 2 col FRAME a.
DISPLAY "Mandatory fields" man-field-count WITH FRAME a.
DISPLAY "Mandatory field array memory required" mem WITH FRAME a.
DISPLAY "Default -Mxs for 100 users " mxs100 WITH FRAME a.
DISPLAY "Total memory required including default -Mxs" (mem + mxs100) WITH FRAME a.
display "-Mxs value including mandatory field array" int(((mem + mxs100) / 1024)) + 1 with frame a.